@SuppressWarnings("rawtypes")
    @Override
    public void visit(Object t, Object parent, int childIndex, Map labels) {
      ASTNode expr = (ASTNode) t;
      ASTNode nameNode = (ASTNode) expr.getChild(0);
      if (nameNode.getText().equals(FunctionRegistry.LEAD_FUNC_NAME)
          || nameNode.getText()
              .equals(FunctionRegistry.LAG_FUNC_NAME)) {
        throwError = true;
        errorNode = expr;
      }
    }
Do the recursive work for visit
ql/src/java/org/apache/hadoop/hive/ql/parse/PTFTranslator.java