private ExprBuilder fn(String name, TypeInfo ti, int args) throws Exception {
      List<ExprNodeDesc> children = new ArrayList<ExprNodeDesc>();
      for (int i = 0; i < args; ++i) {
        children.add(stack.pop());
      }
      stack.push(new ExprNodeGenericFuncDesc(ti,
          FunctionRegistry.getFunctionInfo(name).getGenericUDF(), children));
      return this;
    }
Helper class for building an expression.
ql/src/test/org/apache/hadoop/hive/metastore/TestMetastoreExpr.java