use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFUtils.ConversionHelper in project hive by apache.
the class GenericUDFBridge method initialize.
@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
try {
udf = getUdfClassInternal().newInstance();
} catch (Exception e) {
throw new UDFArgumentException("Unable to instantiate UDF implementation class " + udfClassName + ": " + e);
}
// Resolve for the method based on argument types
ArrayList<TypeInfo> argumentTypeInfos = new ArrayList<TypeInfo>(arguments.length);
for (ObjectInspector argument : arguments) {
argumentTypeInfos.add(TypeInfoUtils.getTypeInfoFromObjectInspector(argument));
}
udfMethod = udf.getResolver().getEvalMethod(argumentTypeInfos);
udfMethod.setAccessible(true);
// Create parameter converters
conversionHelper = new ConversionHelper(udfMethod, arguments);
// Create the non-deferred realArgument
realArguments = new Object[arguments.length];
// Get the return ObjectInspector.
ObjectInspector returnOI = ObjectInspectorFactory.getReflectionObjectInspector(udfMethod.getGenericReturnType(), ObjectInspectorOptions.JAVA);
return returnOI;
}
Aggregations