Class AbstractHyperLogLog

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

public abstract class AbstractHyperLogLog
extends java.lang.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.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static interface  AbstractHyperLogLog.RunLenIterator
    Iterator over a HyperLogLog register
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected int m  
    static int MAX_PRECISION  
    static int MIN_PRECISION  
    protected int p  
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractHyperLogLog​(int precision)  
  • Method Summary

    Modifier and Type Method Description
    protected abstract void addRunLen​(long bucketOrd, int register, int runLen)
    Add a new runLen to the register.
    long cardinality​(long bucketOrd)
    Returns the current computed cardinality
    void collect​(long bucketOrd, long hash)  
    void collectEncoded​(long bucketOrd, int encoded)  
    protected abstract AbstractHyperLogLog.RunLenIterator getRunLens​(long bucketOrd)
    Returns an iterator over all values of the register.
    int precision()
    Precision of the algorithm

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • 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