in src/main/java/org/apache/datasketches/hive/cpc/DataToSketchUDAF.java [85:117]
public GenericUDAFEvaluator getEvaluator(final GenericUDAFParameterInfo info) throws SemanticException {
final ObjectInspector[] inspectors = info.getParameterObjectInspectors();
// Validate the correct number of parameters
if (inspectors.length < 1) {
throw new UDFArgumentException("Please specify at least 1 argument");
}
if (inspectors.length > 3) {
throw new UDFArgumentException("Please specify no more than 3 arguments");
}
// Validate first parameter type
ObjectInspectorValidator.validateCategoryPrimitive(inspectors[0], 0);
// Validate second argument if present
if (inspectors.length > 1) {
ObjectInspectorValidator.validateIntegralParameter(inspectors[1], 1);
if (!ObjectInspectorUtils.isConstantObjectInspector(inspectors[1])) {
throw new UDFArgumentTypeException(1, "The second argument must be a constant");
}
}
// Validate third argument if present
if (inspectors.length > 2) {
ObjectInspectorValidator.validateIntegralParameter(inspectors[2], 2);
if (!ObjectInspectorUtils.isConstantObjectInspector(inspectors[2])) {
throw new UDFArgumentTypeException(2, "The third argument must be a constant");
}
}
return new DataToSketchEvaluator();
}