in src/main/java/org/apache/datasketches/hive/tuple/DataToDoubleSummaryWithModeSketchUDAF.java [112:132]
public ObjectInspector init(final Mode mode, final ObjectInspector[] inspectors) throws HiveException {
final ObjectInspector resultInspector = super.init(mode, inspectors);
if (mode == Mode.PARTIAL1 || mode == Mode.COMPLETE) {
// input is original data
if (inspectors.length > 4) {
this.summaryModeInspector_ = (PrimitiveObjectInspector) inspectors[4];
}
}
if (mode == Mode.PARTIAL1 || mode == Mode.PARTIAL2) {
// intermediate results need to include the nominal number of entries and the summary mode
return ObjectInspectorFactory.getStandardStructObjectInspector(
Arrays.asList(NOMINAL_NUM_ENTRIES_FIELD, SUMMARY_MODE_FIELD, SKETCH_FIELD),
Arrays.asList(
PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(PrimitiveCategory.INT),
PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(PrimitiveCategory.STRING),
PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(PrimitiveCategory.BINARY)
)
);
}
return resultInspector;
}