protected void walk(Node nd) throws SemanticException {
    Deque<NodeLabeled> traversalStack = new ArrayDeque<>();
    traversalStack.push(new NodeLabeled(nd));

    opStack.push(nd);

    while(!traversalStack.isEmpty()) {
      NodeLabeled currLabeledNode = traversalStack.peek();
      Node currNode = currLabeledNode.getNd();
      int currIdx = currLabeledNode.getCurrChildIdx();

      if(currNode.getChildren() != null && currNode.getChildren().size() > currIdx + 1) {
        Node nextChild = currNode.getChildren().get(currIdx+1);
        //check if this node should be skipped and not dispatched
        if(shouldByPass(nextChild, currNode)) {
          retMap.put(nextChild, null);
          currLabeledNode.incrementChildIdx();
          continue;
        }
        traversalStack.push(new NodeLabeled(nextChild));
        opStack.push(nextChild);
        currLabeledNode.incrementChildIdx();
      } else {
        // dispatch the node
        dispatch(currNode, opStack);
        opQueue.add(currNode);
        opStack.pop();
        traversalStack.pop();
      }
    }
  }
walk the current operator and its descendants.

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