Class AbstractHyperLogLog

java.lang.Object
org.elasticsearch.search.aggregations.metrics.AbstractHyperLogLog

public abstract class AbstractHyperLogLog extends Object
Hyperloglog counter, implemented based on pseudo code from http://static.googleusercontent.com/media/research.google.com/fr//pubs/archive/40671.pdf and its appendix https://docs.google.com/document/d/1gyjfMHy43U9OWBXxfaeG-3MjGzejW1dlpyMwEYAAWEI/view?fullscreen Trying to understand what this class does without having read the paper is considered adventurous.
  • Field Details

    • m

      protected final int m
    • MIN_PRECISION

      public static final int MIN_PRECISION
      See Also:
      Constant Field Values
    • MAX_PRECISION

      public static final int MAX_PRECISION
      See Also:
      Constant Field Values
    • p

      protected final int p
  • Constructor Details

    • AbstractHyperLogLog

      public AbstractHyperLogLog(int precision)
  • Method Details

    • addRunLen

      protected abstract void addRunLen(long bucketOrd, int register, int runLen)
      Add a new runLen to the register. Implementor should only keep the value if it is bigger that the current value of the register provided.
    • getRunLens

      protected abstract AbstractHyperLogLog.RunLenIterator getRunLens(long bucketOrd)
      Returns an iterator over all values of the register.
    • collect

      public void collect(long bucketOrd, long hash)
    • cardinality

      public long cardinality(long bucketOrd)
      Returns the current computed cardinality
    • collectEncoded

      public void collectEncoded(long bucketOrd, int encoded)
    • precision

      public int precision()
      Precision of the algorithm