public HyperLogLog squash(final int p0) {
    if (p0 > p) {
      throw new IllegalArgumentException(
          "HyperLogLog cannot be be squashed to be bigger. Current: "
              + toString() + " Provided: " + p0);
    }

    if (p0 == p) {
      return this;
    }

    final HyperLogLog hll = new HyperLogLogBuilder()
        .setNumRegisterIndexBits(p0).setEncoding(EncodingType.DENSE)
        .enableNoBias(noBias).build();
    final HLLDenseRegister result = hll.denseRegister;

    if (encoding == EncodingType.SPARSE) {
      sparseRegister.extractLowBitsTo(result);
    } else if (encoding == EncodingType.DENSE) {
      denseRegister.extractLowBitsTo(result);
    }
    return hll;
  }
Reduces the accuracy of the HLL provided to a smaller size
@param p0
        - new p size for the new HyperLogLog (smaller or no change)
@return reduced (or same) HyperLogLog instance
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/common/ndv/hll/HyperLogLog.java