use of org.apache.hadoop.hive.serde2.objectinspector.primitive.SettableHiveDecimalObjectInspector in project hive by apache.
the class GenericUDFToDecimal method initialize.
@Override
public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
if (arguments.length < 1) {
throw new UDFArgumentLengthException("The function DECIMAL requires at least one argument, got " + arguments.length);
}
try {
argumentOI = (PrimitiveObjectInspector) arguments[0];
} catch (ClassCastException e) {
throw new UDFArgumentException("The function DECIMAL takes only primitive types");
}
// Check if this UDF has been provided with type params for the output varchar type
SettableHiveDecimalObjectInspector outputOI;
outputOI = (SettableHiveDecimalObjectInspector) PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(typeInfo);
bdConverter = new HiveDecimalConverter(argumentOI, outputOI);
return outputOI;
}
Aggregations