private void semijoinRemovalBasedTransformations(OptimizeTezProcContext procCtx) throws SemanticException {
    PerfLogger perfLogger = SessionState.getPerfLogger();

    final boolean dynamicPartitionPruningEnabled =
        procCtx.conf.getBoolVar(ConfVars.TEZ_DYNAMIC_PARTITION_PRUNING);
    final boolean semiJoinReductionEnabled = dynamicPartitionPruningEnabled &&
        procCtx.conf.getBoolVar(ConfVars.TEZ_DYNAMIC_SEMIJOIN_REDUCTION) &&
            procCtx.parseContext.getRsToSemiJoinBranchInfo().size() != 0;
    final boolean extendedReductionEnabled = dynamicPartitionPruningEnabled &&
        procCtx.conf.getBoolVar(ConfVars.TEZ_DYNAMIC_PARTITION_PRUNING_EXTENDED);

    perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
    if (dynamicPartitionPruningEnabled) {
      runRemoveDynamicPruningOptimization(procCtx);
    }
    perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Run remove dynamic pruning by size");

    if (semiJoinReductionEnabled) {
      perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
      markSemiJoinForDPP(procCtx);
      perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Mark certain semijoin edges important based ");

      // Remove any semi join edges from Union Op
      perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
      removeSemiJoinEdgesForUnion(procCtx);
      perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER,
                            "Remove any semi join edge between Union and RS");

      // Remove any parallel edge between semijoin and mapjoin.
      perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
      removeSemijoinsParallelToMapJoin(procCtx);
      perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Remove any parallel edge between semijoin and mapjoin");

      // Remove semijoin optimization if SMB join is created.
      perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
      removeSemijoinOptimizationFromSMBJoins(procCtx);
      perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Remove semijoin optimizations if needed");

      // Remove bloomfilter if no stats generated
      perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
      removeSemiJoinIfNoStats(procCtx);
      perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Remove bloom filter optimizations if needed");

      // Removing semijoin optimization when it may not be beneficial
      perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
      removeSemijoinOptimizationByBenefit(procCtx);
      perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Remove Semijoins based on cost benefits");
    }

    // after the stats phase we might have some cyclic dependencies that we need
    // to take care of.
    perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
    if (dynamicPartitionPruningEnabled) {
      runCycleAnalysisForPartitionPruning(procCtx);
    }
    perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Run cycle analysis for partition pruning");

    // remove redundant dpp and semijoins
    perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.TEZ_COMPILER);
    if (extendedReductionEnabled) {
      removeRedundantSemijoinAndDpp(procCtx);
    }
    perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.TEZ_COMPILER, "Remove redundant semijoin reduction");
  }
TezCompiler translates the operator plan into TezTasks.
ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java