public static Set<Operator<?>>
  findWorkOperatorsAndSemiJoinEdges(Operator<?> start,
                                    final Map<ReduceSinkOperator, SemiJoinBranchInfo> rsToSemiJoinBranchInfo,
                                    Set<ReduceSinkOperator> semiJoinOps, Set<TerminalOperator<?>> terminalOps) {
    Set<Operator<?>> found = new HashSet<>();
    findWorkOperatorsAndSemiJoinEdges(start,
            found, rsToSemiJoinBranchInfo, semiJoinOps, terminalOps);
    return found;
  }
Remove operator from the tree, disconnecting it from its
parents and children.
ql/src/java/org/apache/hadoop/hive/ql/exec/OperatorUtils.java