private static void _visit(Object t, Object parent, int childIndex, ContextVisitor visitor) {
    if (t == null) {
      return;
    }
    visitor.visit(t, parent, childIndex, null);
    int n = ParseDriver.adaptor.getChildCount(t);
    for (int i = 0; i < n; i++) {
      Object child = ParseDriver.adaptor.getChild(t, i);
      _visit(child, t, i, visitor);
    }
  }
Do the recursive work for visit
ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java