public class HLLSparseRegister extends Object implements HLLRegister
| Constructor and Description |
|---|
HLLSparseRegister(int p,
int pp,
int qp) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(long hashcode)
Specify a hashcode to add to hyperloglog register.
|
int |
encodeHash(long hashcode)
Input: 64 bit hashcode
|---------w-------------| |------------p'----------|
10101101.......1010101010 10101010101 01010101010101
|------p-----|
Output: 32 bit int
|b| |-q'-| |------------p'----------|
1 010101 01010101010 10101010101010
|------p-----|
The default values of p', q' and b are 25, 6, 1 (total 32 bits) respectively.
|
boolean |
equals(Object obj) |
void |
extractLowBitsTo(HLLRegister dest) |
int |
getP() |
int |
getPPrime() |
int |
getSize() |
TreeMap<Integer,Byte> |
getSparseMap() |
int |
hashCode() |
void |
merge(HLLRegister hllRegister)
Merge hyperloglog registers of the same type (SPARSE or DENSE register)
|
boolean |
set(int key,
byte value)
Instead of specifying hashcode, this interface can be used to directly
specify the register index and register value.
|
String |
toExtendedString() |
String |
toString() |
public boolean add(long hashcode)
HLLRegisteradd in interface HLLRegisterhashcode - - hashcode to addpublic int encodeHash(long hashcode)
Input: 64 bit hashcode
|---------w-------------| |------------p'----------|
10101101.......1010101010 10101010101 01010101010101
|------p-----|
Output: 32 bit int
|b| |-q'-| |------------p'----------|
1 010101 01010101010 10101010101010
|------p-----|
The default values of p', q' and b are 25, 6, 1 (total 32 bits) respectively.
This function will return an int encoded in the following format
p - LSB p bits represent the register index
p' - LSB p' bits are used for increased accuracy in estimation
q' - q' bits after p' are left as such from the hashcode if b = 0 else
q' bits encodes the longest trailing zero runs from in (w-p) input bits
b - 0 if longest trailing zero run is contained within (p'-p) bits
1 if longest trailing zero run is computeed from (w-p) input bits and
its value is stored in q' bits
hashcode - public int getSize()
public void merge(HLLRegister hllRegister)
HLLRegistermerge in interface HLLRegisterhllRegister - - register to be mergedpublic boolean set(int key,
byte value)
HLLRegisterset in interface HLLRegisterkey - - register indexvalue - - register valuepublic void extractLowBitsTo(HLLRegister dest)
public int getP()
public int getPPrime()
public String toExtendedString()
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.