private void walkSubtree(Operator<?> root) {
      Deque<Operator<?>> deque = new LinkedList<>();
      deque.add(root);
      while (!deque.isEmpty()) {
        Operator<?> op = deque.pollLast();
        mark(op);
        if (op instanceof ReduceSinkOperator) {
          // Done with this branch
        } else {
          deque.addAll(op.getChildOperators());
        }
      }
    }
TezCompiler translates the operator plan into TezTasks.
ql/src/java/org/apache/hadoop/hive/ql/parse/TezCompiler.java