@SuppressWarnings("unchecked")
  @Override
  public void startWalking(Collection<Node> startNodes,
      HashMap<Node, Object> nodeOutput) throws SemanticException {
    toWalk.addAll(startNodes);

    // Starting from the startNodes, add the children whose parents have been
    // included in the list.
    Set<Node> addedNodes = new HashSet<>(startNodes);
    int index = 0;
    while (index < toWalk.size()) {
      List<? extends Node> children = toWalk.get(index).getChildren();
      if (CollectionUtils.isNotEmpty(children)) {
        for (Node child : children) {
          Operator<? extends OperatorDesc> childOP =
              (Operator<? extends OperatorDesc>) child;

          if (!addedNodes.contains(child)
              && (childOP.getParentOperators() == null
                  || addedNodes.containsAll(childOP.getParentOperators()))) {
            toWalk.add(child);
            addedNodes.add(child);
          }
        }
      }
      ++index;
    }

    for (Node nd : toWalk) {
      if (!nodeTypes.isEmpty() && !nodeTypes.contains(nd.getClass())) {
        continue;
      }

      opStack.clear();
      opStack.push(nd);
      walk(nd, 0, opStack);
      if (nodeOutput != null && getDispatchedList().contains(nd)) {
        nodeOutput.put(nd, retMap.get(nd));
      }
    }
  }
starting point for walking.

@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/lib/LevelOrderWalker.java