@Override
  public ObjectInspector initialize(ObjectInspector[] arguments)
  throws UDFArgumentException {
    
    if (arguments.length < 2) {
      throw new UDFArgumentLengthException(
          "The function GenericUDFReflect(class,method[,arg1[,arg2]...])"
          + " accepts 2 or more arguments.");
    }

    for (int i = 0; i < 2; i++) {
      if (!(arguments[i] instanceof StringObjectInspector)) {
        throw new UDFArgumentTypeException(i,
            "The first 2 parameters of GenericUDFReflect(class,method[,arg1[,arg2]...])"
            + " should be string.");
      }
    }
    inputClassNameOI = (StringObjectInspector) arguments[0];
    inputMethodNameOI = (StringObjectInspector) arguments[1];

    classNameOI = (StringObjectInspector)
        ObjectInspectorUtils.getStandardObjectInspector(arguments[0]);
    methodNameOI = (StringObjectInspector)
        ObjectInspectorUtils.getStandardObjectInspector(arguments[1]);

    setupParameterOIs(arguments, 2);

    return PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(
        PrimitiveCategory.STRING);
  }
A simple generic udf to call java static functions via reflection.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFReflect.java