in src/main/java/org/apache/datasketches/hive/tuple/DataToSketchUDAF.java [52:82]
public GenericUDAFEvaluator getEvaluator(final GenericUDAFParameterInfo info) throws SemanticException {
final ObjectInspector[] inspectors = info.getParameterObjectInspectors();
if (inspectors.length < 2) {
throw new UDFArgumentException("Expected at least 2 arguments");
}
ObjectInspectorValidator.validateCategoryPrimitive(inspectors[0], 0);
// No validation of the value inspector since it can be anything.
// Override this method to validate if needed.
// nominal number of entries
if (inspectors.length > 2) {
ObjectInspectorValidator.validateIntegralParameter(inspectors[2], 2);
}
// sampling probability
if (inspectors.length > 3) {
ObjectInspectorValidator.validateCategoryPrimitive(inspectors[3], 3);
final PrimitiveObjectInspector primitiveInspector = (PrimitiveObjectInspector) inspectors[3];
if (primitiveInspector.getPrimitiveCategory() != PrimitiveCategory.FLOAT
&& primitiveInspector.getPrimitiveCategory() != PrimitiveCategory.DOUBLE) {
throw new UDFArgumentTypeException(3, "float or double value expected as parameter 4 but "
+ primitiveInspector.getPrimitiveCategory().name() + " was received");
}
}
checkExtraArguments(inspectors);
return createEvaluator();
}