java.lang.Object
org.apache.flink.table.runtime.functions.aggregate.hyperloglog.HyperLogLogPlusPlus

public class HyperLogLogPlusPlus extends Object
The implement of HyperLogLogPlusPlus is inspired from Apache Spark.
  • Constructor Details

    • HyperLogLogPlusPlus

      public HyperLogLogPlusPlus(double relativeSD)
  • Method Details

    • getNumWords

      public int getNumWords()
    • updateByHashcode

      public void updateByHashcode(HllBuffer buffer, long hash)
      Update the HLL++ buffer.
    • merge

      public void merge(HllBuffer buffer1, HllBuffer buffer2)
      Merge the HLL buffers by iterating through the registers in both buffers and select the maximum number of leading zeros for each register.
    • estimateBias

      public double estimateBias(double e)
      Estimate the bias using the raw estimates with their respective biases from the HLL++ appendix. We currently use KNN interpolation to determine the bias (as suggested in the paper).
    • query

      public long query(HllBuffer buffer)
      Compute the HyperLogLog estimate.

      Variable names in the HLL++ paper match variable names in the code.

    • trueRsd

      public double trueRsd()
      The rsd of HLL++ is always equal to or better than the rsd requested. This method returns the rsd this instance actually guarantees.
      Returns:
      the actual rsd.