Package org.apache.datasketches.hll
Enum TgtHllType
- java.lang.Object
-
- java.lang.Enum<TgtHllType>
-
- org.apache.datasketches.hll.TgtHllType
-
- All Implemented Interfaces:
Serializable
,Comparable<TgtHllType>
public enum TgtHllType extends Enum<TgtHllType>
Specifies the target type of HLL sketch to be created. It is a target in that the actual allocation of the HLL array is deferred until sufficient number of items have been received by the warm-up phases.These three target types are isomorphic representations of the same underlying HLL algorithm. Thus, given the same value of lgConfigK and the same input, all three HLL target types will produce identical estimates and have identical error distributions.
The memory (and also the serialization) of the sketch during this early warmup phase starts out very small (8 bytes, when empty) and then grows in increments of 4 bytes as required until the full HLL array is allocated. This transition point occurs at about 10% of K for sketches where lgConfigK is > 8.
- HLL 8 This uses an 8-bit byte per HLL bucket. It is generally the fastest in terms of update time, but has the largest storage footprint of about K bytes.
- HLL 6 This uses a 6-bit field per HLL bucket. It is the generally the next fastest in terms of update time with a storage footprint of about 3/4 * K bytes.
- HLL 4 This uses a 4-bit field per HLL bucket and for large counts may require the use of a small internal auxiliary array for storing statistical exceptions, which are rare. For the values of lgConfigK > 13 (K = 8192), this additional array adds about 3% to the overall storage. It is generally the slowest in terms of update time, but has the smallest storage footprint of about K/2 * 1.03 bytes.
- Author:
- Lee Rhodes
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TgtHllType
fromOrdinal(int typeId)
Convert the typeId to the enum typestatic TgtHllType
valueOf(String name)
Returns the enum constant of this type with the specified name.static TgtHllType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HLL_4
public static final TgtHllType HLL_4
An HLL sketch with a bin size of 4 bits
-
HLL_6
public static final TgtHllType HLL_6
An HLL sketch with a bin size of 6 bits
-
HLL_8
public static final TgtHllType HLL_8
An Hll Sketch with a bin size of 8 bits
-
-
Method Detail
-
values
public static TgtHllType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TgtHllType c : TgtHllType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TgtHllType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromOrdinal
public static final TgtHllType fromOrdinal(int typeId)
Convert the typeId to the enum type- Parameters:
typeId
- the given typeId- Returns:
- the enum type
-
-