Module org.elasticsearch.server
Class AbstractHyperLogLogPlusPlus
java.lang.Object
org.elasticsearch.search.aggregations.metrics.AbstractHyperLogLogPlusPlus
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Releasable
- Direct Known Subclasses:
HyperLogLogPlusPlus
Base class for HLL++ algorithms.
It contains methods for cloning and serializing the data structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
static final boolean
static final int
static final int
protected final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract long
cardinality
(long bucketOrd) Returns the current computed cardinalityClone the data structure at the given bucketabstract void
collect
(long bucketOrd, long hash) Collect a value in the given bucketboolean
equals
(long thisBucket, AbstractHyperLogLogPlusPlus other, long otherBucket) protected abstract boolean
getAlgorithm
(long bucketOrd) Algorithm used in the given bucketprotected abstract AbstractHyperLogLog.RunLenIterator
getHyperLogLog
(long bucketOrd) Get HyperLogLog algorithmprotected abstract AbstractLinearCounting.HashesIterator
getLinearCounting
(long bucketOrd) Get linear counting algorithmint
hashCode
(long bucket) int
Precision of the algorithmstatic AbstractHyperLogLogPlusPlus
readFrom
(StreamInput in, BigArrays bigArrays) void
writeTo
(long bucket, StreamOutput out) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
LINEAR_COUNTING
public static final boolean LINEAR_COUNTING- See Also:
-
HYPERLOGLOG
public static final boolean HYPERLOGLOG- See Also:
-
MIN_PRECISION
public static final int MIN_PRECISION- See Also:
-
MAX_PRECISION
public static final int MAX_PRECISION- See Also:
-
p
protected final int p
-
-
Constructor Details
-
AbstractHyperLogLogPlusPlus
public AbstractHyperLogLogPlusPlus(int precision)
-
-
Method Details
-
getAlgorithm
protected abstract boolean getAlgorithm(long bucketOrd) Algorithm used in the given bucket -
getLinearCounting
Get linear counting algorithm -
getHyperLogLog
Get HyperLogLog algorithm -
collect
public abstract void collect(long bucketOrd, long hash) Collect a value in the given bucket -
clone
Clone the data structure at the given bucket -
writeTo
- Throws:
IOException
-
readFrom
public static AbstractHyperLogLogPlusPlus readFrom(StreamInput in, BigArrays bigArrays) throws IOException - Throws:
IOException
-
equals
-
hashCode
public int hashCode(long bucket) -
precision
public int precision()Precision of the algorithm -
cardinality
public abstract long cardinality(long bucketOrd) Returns the current computed cardinality
-