Class AbstractHyperLogLog
java.lang.Object
org.elasticsearch.search.aggregations.metrics.AbstractHyperLogLog
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 ClassesModifier and TypeClassDescriptionstatic interfaceIterator over a HyperLogLog register -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intstatic intstatic intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddRunLen(long bucketOrd, int register, int runLen)Add a new runLen to the register.longcardinality(long bucketOrd)Returns the current computed cardinalityvoidcollect(long bucketOrd, long hash)voidcollectEncoded(long bucketOrd, int encoded)protected abstract AbstractHyperLogLog.RunLenIteratorgetRunLens(long bucketOrd)Returns an iterator over all values of the register.intPrecision of the algorithm
-
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
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
-