Class HyperLogLogPlusPlus

  • All Implemented Interfaces:, java.lang.AutoCloseable, Releasable

    public final class HyperLogLogPlusPlus
    extends java.lang.Object
    implements Releasable
    Hyperloglog++ counter, implemented based on pseudo code from and its appendix This implementation is different from the original implementation in that it uses a hash table instead of a sorted list for linear counting. Although this requires more space and makes hyperloglog (which is less accurate) used sooner, this is also considerably faster. Trying to understand what this class does without having read the paper is considered adventurous.
    • Constructor Detail

      • HyperLogLogPlusPlus

        public HyperLogLogPlusPlus​(int precision,
                                   BigArrays bigArrays,
                                   long initialBucketCount)
    • Method Detail

      • precisionFromThreshold

        public static int precisionFromThreshold​(long count)
        Compute the required precision so that count distinct entries would be counted with linear counting.
      • memoryUsage

        public static long memoryUsage​(int precision)
        Return the expected per-bucket memory usage for the given precision.
      • precision

        public int precision()
      • maxBucket

        public long maxBucket()
      • merge

        public void merge​(long thisBucket,
                          HyperLogLogPlusPlus other,
                          long otherBucket)
      • collect

        public void collect​(long bucket,
                            long hash)
      • cardinality

        public long cardinality​(long bucket)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface
        Specified by:
        close in interface Releasable
      • hashCode

        public int hashCode​(long bucket)
      • writeTo

        public void writeTo​(long bucket,
                            StreamOutput out)