protected void walk(Node nd) throws SemanticException {
    // Push the node in the stack
    opStack.push(nd);

    // While there are still nodes to dispatch...
    while (!opStack.empty()) {
      Node node = opStack.peek();

      if (node.getChildren() == null ||
              getDispatchedList().containsAll(node.getChildren())) {
        // Dispatch current node
        if (!getDispatchedList().contains(node)) {
          dispatch(node, opStack);
          opQueue.add(node);
        }
        opStack.pop();
        continue;
      }

      // Add a single child and restart the loop
      for (Node childNode : node.getChildren()) {
        // skip if already dispatched
        if (getDispatchedList().contains(childNode)) {
          continue;
        }

        boolean hasChildren = childNode.getChildren() != null;
        opStack.push(childNode);
        if (hasChildren) {
          // exit loop to process child's children
          break;
        } else { // no children - safe to dispatch in-line
          dispatch(childNode, opStack);
          opQueue.add(childNode);
          opStack.pop();
        }
      }
    } // end while
  }
walk the current operator and its descendants.

@param nd
         current operator in the graph
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/lib/DefaultGraphWalker.java