@Test
  public void testLookupFunctionOnDemand() throws Exception {
    TypeCheckProcFactory.DefaultExprProcessor defaultExprProcessor =
        ExprNodeTypeCheck.getExprNodeDefaultExprProcessor();
    ASTNode funcExpr = new ASTNode(new CommonToken(HiveParser.TOK_FUNCTION, "TOK_FUNCTION"));
    funcExpr.addChild(new ASTNode(new CommonToken(HiveParser.Identifier, "myupper")));
    funcExpr.addChild(new ASTNode(new CommonToken(HiveParser.StringLiteral, "test")));
    List<ExprNodeDesc> children = new ArrayList<ExprNodeDesc>();
    children.add(new ExprNodeConstantDesc(TypeInfoFactory.stringTypeInfo, "test"));
    // getXpathOrFuncExprNodeDesc cannot access from outside package
    ExprNodeDesc exprNodeDesc = (ExprNodeDesc) defaultExprProcessor.
        getXpathOrFuncExprNodeDesc(funcExpr, true, children, new TypeCheckCtx(null));
    Assert.assertNotNull(exprNodeDesc);
    Assert.assertNotNull(((ExprNodeGenericFuncDesc)exprNodeDesc).getGenericUDF());
  }
Check the genericUDF field of FunctionInfo returned on demand.
ql/src/test/org/apache/hadoop/hive/ql/parse/type/TestExprProcessorGetFuncExpr.java