public static final class HllCount.Init
extends java.lang.Object
PTransforms to aggregate inputs into HLL++ sketches. The four supported input
types are Integer, Long, String, and byte[].
Sketches are represented using the byte[] type. Sketches of the same type can be
merged into a new sketch using HllCount.MergePartial. Estimated count of distinct
elements can be extracted from sketches using HllCount.Extract.
An "empty sketch" represented by an byte array of length 0 is returned if the input PCollection is empty.
Corresponds to the HLL_COUNT.INIT(input [, precision]) function in BigQuery.
| Modifier and Type | Class and Description |
|---|---|
static class |
HllCount.Init.Builder<InputT>
Builder for the
HllCount.Init combining PTransform. |
| Modifier and Type | Method and Description |
|---|---|
static HllCount.Init.Builder<byte[]> |
forBytes()
Returns a
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes bytes-type HLL++ sketches. |
static HllCount.Init.Builder<java.lang.Integer> |
forIntegers()
Returns a
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes integer-type HLL++ sketches. |
static HllCount.Init.Builder<java.lang.Long> |
forLongs()
Returns a
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes long-type HLL++ sketches. |
static HllCount.Init.Builder<java.lang.String> |
forStrings()
Returns a
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes string-type HLL++ sketches. |
public static HllCount.Init.Builder<java.lang.Integer> forIntegers()
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes integer-type HLL++ sketches. Call HllCount.Init.Builder.globally() or HllCount.Init.Builder.perKey() on the returning HllCount.Init.Builder to finalize the PTransform.
Calling HllCount.Init.Builder.globally() returns a PTransform that takes an input PCollection<Integer> and returns a PCollection<byte[]> which consists of the
integer-type HLL++ sketch computed from the elements in the input PCollection.
Calling HllCount.Init.Builder.perKey() returns a PTransform that takes an input PCollection<KV<K, Integer>> and returns a PCollection<KV<K, byte[]>> which consists
of the per-key integer-type HLL++ sketch computed from the values matching each key in the
input PCollection.
Integer-type sketches cannot be merged with sketches of other types.
public static HllCount.Init.Builder<java.lang.Long> forLongs()
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes long-type HLL++ sketches. Call HllCount.Init.Builder.globally() or HllCount.Init.Builder.perKey() on the returning HllCount.Init.Builder to finalize the PTransform.
Calling HllCount.Init.Builder.globally() returns a PTransform that takes an input PCollection<Long> and returns a PCollection<byte[]> which consists of the long-type
HLL++ sketch computed from the elements in the input PCollection.
Calling HllCount.Init.Builder.perKey() returns a PTransform that takes an input PCollection<KV<K, Long>> and returns a PCollection<KV<K, byte[]>> which consists of
the per-key long-type HLL++ sketch computed from the values matching each key in the input
PCollection.
Long-type sketches cannot be merged with sketches of other types.
public static HllCount.Init.Builder<java.lang.String> forStrings()
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes string-type HLL++ sketches. Call HllCount.Init.Builder.globally() or HllCount.Init.Builder.perKey() on the returning HllCount.Init.Builder to finalize the PTransform.
Calling HllCount.Init.Builder.globally() returns a PTransform that takes an input PCollection<String> and returns a PCollection<byte[]> which consists of the
string-type HLL++ sketch computed from the elements in the input PCollection.
Calling HllCount.Init.Builder.perKey() returns a PTransform that takes an input PCollection<KV<K, String>> and returns a PCollection<KV<K, byte[]>> which consists
of the per-key string-type HLL++ sketch computed from the values matching each key in the
input PCollection.
String-type sketches cannot be merged with sketches of other types.
public static HllCount.Init.Builder<byte[]> forBytes()
HllCount.Init.Builder for a HllCount.Init combining PTransform that
computes bytes-type HLL++ sketches. Call HllCount.Init.Builder.globally() or HllCount.Init.Builder.perKey() on the returning HllCount.Init.Builder to finalize the PTransform.
Calling HllCount.Init.Builder.globally() returns a PTransform that takes an input PCollection<byte[]> and returns a PCollection<byte[]> which consists of the
bytes-type HLL++ sketch computed from the elements in the input PCollection.
Calling HllCount.Init.Builder.perKey() returns a PTransform that takes an input PCollection<KV<K, byte[]>> and returns a PCollection<KV<K, byte[]>> which consists
of the per-key bytes-type HLL++ sketch computed from the values matching each key in the
input PCollection.
Bytes-type sketches cannot be merged with sketches of other types.