private void runDFS(Set<Operator<?>> known, List<Operator<?>> roots, Class<?>... terminals) {

      Queue<Operator<?>> pending = new LinkedList<>();
      pending.addAll(roots);

      while (!pending.isEmpty()) {
        Operator<?> o = pending.poll();
        known.add(o);
        if (!isTerminal(o)) {
          pending.addAll(o.getChildOperators());
        }
      }
    }
Temporarily truncates the operator tree to avoid full cloning of the tree.

It does the following simplifications:
<ul>
 <li> hides UNION operator parents which are unrelated to the current set of roots
 <li> hides childs from RS and FS operators
<ul>
ql/src/java/org/apache/hadoop/hive/ql/parse/GenTezUtils.java