@Override
    public AggregationBuffer getNewAggregationBuffer() throws HiveException {
      AggregationBuffer result = new GenericUDAFComputeBitVectorBase.DoubleStatsAgg();
      reset(result);
      return result;
    }
GenericUDAFComputeBitVector. This UDAF will compute a bit vector using
FMSketch algorithm. The ndv_compute_bit_vector function can
be used on top of it to extract an estimate of the ndv from it.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFComputeBitVectorFMSketch.java