public ObjectInspector init()

in src/main/java/org/apache/datasketches/hive/tuple/DataToSketchUDAF.java [113:143]


    public ObjectInspector init(final Mode mode, final ObjectInspector[] inspectors) throws HiveException {
      super.init(mode, inspectors);
      this.mode_ = mode;
      if (mode == Mode.PARTIAL1 || mode == Mode.COMPLETE) {
        // input is original data
        this.keyInspector_ = (PrimitiveObjectInspector) inspectors[0];
        this.valueInspector_ = (PrimitiveObjectInspector) inspectors[1];
        if (inspectors.length > 2) {
          this.nominalNumEntriesInspector_ = (PrimitiveObjectInspector) inspectors[2];
        }
        if (inspectors.length > 3) {
          this.samplingProbabilityInspector_ = (PrimitiveObjectInspector) inspectors[3];
        }
      } else {
        // input for PARTIAL2 and FINAL is the output from PARTIAL1
        this.intermediateInspector_ = (StructObjectInspector) inspectors[0];
      }

      if (mode == Mode.PARTIAL1 || mode == Mode.PARTIAL2) {
        // intermediate results need to include the nominal number of entries
        return ObjectInspectorFactory.getStandardStructObjectInspector(
          Arrays.asList(NOMINAL_NUM_ENTRIES_FIELD, SKETCH_FIELD),
          Arrays.asList(
            PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(PrimitiveCategory.INT),
            PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(PrimitiveCategory.BINARY)
          )
        );
      }
      // final results include just the sketch
      return PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(PrimitiveCategory.BINARY);
    }