private void removeSemiJoinEdges(Operator<?> op, OptimizeTezProcContext procCtx,
                                   Map<ReduceSinkOperator, TableScanOperator> sjToRemove) throws SemanticException {
    if(op instanceof ReduceSinkOperator && op.getNumChild() == 0) {
      Map<ReduceSinkOperator, SemiJoinBranchInfo> sjMap = procCtx.parseContext.getRsToSemiJoinBranchInfo();
      if(sjMap.get(op) != null) {
        sjToRemove.put((ReduceSinkOperator)op, sjMap.get(op).getTsOp());
      }
    }

    for(Operator<?> child:op.getChildOperators()) {
      removeSemiJoinEdges(child, procCtx, sjToRemove);
    }
  }
TezCompiler translates the operator plan into TezTasks.
ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java