public class HyperLogLogPlus extends Object implements ICardinality, Serializable
http://static.googleusercontent.com/external_content/untrusted_dlcp/research.google.com/en/us/pubs/archive/40671.pdf
Brief HyperLogLog++ Overview Uses 64 bit hashing instead of 32 Has two representation modes: sparse and normal 'normal' is approximately the same as regular hyperloglog (still uses 64 bits) 'sparse' handles lower cardinality values with a highly accurate but poorly scaling strategy and leverages data compression to compete with 'normal' for as long as possible (sparse has the advantage on accuracy per unit of memory at low cardinality but quickly falls behind).| Modifier and Type | Class and Description |
|---|---|
static class |
HyperLogLogPlus.Builder |
| Modifier and Type | Field and Description |
|---|---|
static int[] |
EMPTY_SPARSE |
| Constructor and Description |
|---|
HyperLogLogPlus(int p)
This constructor disables the sparse set.
|
HyperLogLogPlus(int p,
int sp)
Basic constructor for creating a instance that supports sparse and normal
representations.
|
HyperLogLogPlus(int p,
int sp,
List<byte[]> deltaByteSet)
Constructor to support instances serialized with the legacy sparse
encoding scheme.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(HyperLogLogPlus other)
Add all the elements of the other set to this set.
|
long |
cardinality()
Gather the cardinality estimate from this estimator.
|
boolean |
equals(Object obj) |
byte[] |
getBytes() |
int |
hashCode() |
ICardinality |
merge(ICardinality... estimators)
Merge this HLL++ with a bunch of others! The power of minions!
Most of the logic consists of case analysis about the state of this HLL++ and each one it wants to merge
with.
|
boolean |
offer(Object o) |
boolean |
offerHashed(int hashedInt)
Offer the value as a hashed long value
|
boolean |
offerHashed(long hashedLong)
Offer the value as a hashed long value
|
int |
sizeof() |
public HyperLogLogPlus(int p)
p - - the precision value for the normal setpublic HyperLogLogPlus(int p,
int sp)
p and
sp define the precision of the Normal and Sparse set
representations for the data structure. p must be a value
between 4 and sp and sp must be less than 32.p - - the precision value for the normal setsp - - the precision value for the sparse setpublic HyperLogLogPlus(int p,
int sp,
List<byte[]> deltaByteSet)
p - - the precision value for the normal setsp - - the precision value for the sparse setdeltaByteSet - - a list of varint byte arrays encoded using a delta encoding schemepublic boolean offerHashed(long hashedLong)
ICardinalityofferHashed in interface ICardinalityhashedLong - - the hash of the item to offer to the estimatorpublic boolean offerHashed(int hashedInt)
ICardinalityofferHashed in interface ICardinalityhashedInt - - the hash of the item to offer to the estimatorpublic boolean offer(Object o)
offer in interface ICardinalityo - stream elementpublic long cardinality()
cardinality in interface ICardinalitypublic int sizeof()
sizeof in interface ICardinalitypublic byte[] getBytes()
throws IOException
getBytes in interface ICardinalityIOExceptionpublic void addAll(HyperLogLogPlus other) throws com.clearspring.analytics.stream.cardinality.HyperLogLogPlus.HyperLogLogPlusMergeException
other - A compatible Hyperloglog++ instance (same p and sp)CardinalityMergeException - if other is not compatiblecom.clearspring.analytics.stream.cardinality.HyperLogLogPlus.HyperLogLogPlusMergeExceptionpublic ICardinality merge(ICardinality... estimators) throws CardinalityMergeException
merge in interface ICardinalityestimators - the estimators to merge with this oneCardinalityMergeExceptionCopyright © 2016 AddThis. All rights reserved.