private boolean isSemiJoinBranch(final GroupByOperator gOp, ReduceSinkDeduplicateProcCtx dedupCtx) {
      for(int i=0; i<gOp.getChildren().size(); i++) {
        if(gOp.getChildren().get(i) instanceof  ReduceSinkOperator) {
          ReduceSinkOperator rsOp = (ReduceSinkOperator)gOp.getChildren().get(i);
          if(dedupCtx.getPctx().getRsToSemiJoinBranchInfo().containsKey(rsOp)) {
            return true;
          }
        }
      }
      return false;
    }
If two reducer sink operators share the same partition/sort columns and order,
they can be merged. This should happen after map join optimization because map
join optimization will remove reduce sink operators.

This optimizer removes/replaces child-RS (not parent) which is safer way for DefaultGraphWalker.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/correlation/ReduceSinkDeDuplication.java