@Override
public GenericUDAFEvaluator getEvaluator(GenericUDAFParameterInfo info)
throws SemanticException {
ObjectInspector[] inspectors = info.getParameterObjectInspectors();
if (inspectors.length != 1) {
throw new UDFArgumentTypeException(inspectors.length - 1,
"Exactly one argument is expected.");
}
if (inspectors[0].getCategory() != ObjectInspector.Category.LIST) {
throw new UDFArgumentTypeException(0, "Argument should be a list type");
}
ListObjectInspector listOI = (ListObjectInspector) inspectors[0];
ObjectInspector elementOI = listOI.getListElementObjectInspector();
if (elementOI.getCategory() != ObjectInspector.Category.PRIMITIVE) {
throw new UDFArgumentTypeException(0,
"Only primitive type arguments are accepted but "
+ elementOI.getTypeName() + " is passed.");
}
PrimitiveObjectInspector.PrimitiveCategory pcat =
((PrimitiveObjectInspector)elementOI).getPrimitiveCategory();