Class HllCount.Init.Builder<InputT extends @Nullable Object>

java.lang.Object
org.apache.beam.sdk.extensions.zetasketch.HllCount.Init.Builder<InputT>
Type Parameters:
InputT - element type or value type in KVs of the input PCollection to the PTransform being built
Enclosing class:
HllCount.Init

public static final class HllCount.Init.Builder<InputT extends @Nullable Object> extends Object
Builder for the HllCount.Init combining PTransform.

Call withPrecision(int) to customize the precision parameter of the sketch.

Call globally() or perKey() to finalize the PTransform.

  • Method Details

    • withPrecision

      public HllCount.Init.Builder<InputT> withPrecision(int precision)
      Explicitly set the precision parameter used to compute HLL++ sketch.

      Valid range is between HllCount.MINIMUM_PRECISION and HllCount.MAXIMUM_PRECISION. If this method is not called, HllCount.DEFAULT_PRECISION will be used. Sketches computed using different precisions cannot be merged together.

      Parameters:
      precision - the precision parameter used to compute HLL++ sketch
    • globally

      public Combine.Globally<InputT,byte[]> globally()
      Returns a Combine.Globally PTransform that takes an input PCollection<InputT> and returns a PCollection<byte[]> which consists of the HLL++ sketch computed from the elements in the input PCollection.

      Returns a singleton PCollection with an "empty sketch" (byte array of length 0) if the input PCollection is empty.

    • perKey

      public <K> Combine.PerKey<K,InputT,byte[]> perKey()
      Returns a Combine.PerKey PTransform that takes an input PCollection<KV<K, InputT>> and returns a PCollection<KV<K, byte[]>> which consists of the per-key HLL++ sketch computed from the values matching each key in the input PCollection.