Enum Class TgtHllType

java.lang.Object
java.lang.Enum<TgtHllType>
org.apache.datasketches.hll.TgtHllType
All Implemented Interfaces:
Serializable, Comparable<TgtHllType>, Constable

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
  • Enum Constant Details

    • 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 Details

    • values

      public static TgtHllType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TgtHllType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - 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