public static final class HllCount.Extract
extends java.lang.Object
PTransform
s to extract the estimated count of distinct elements (as Long
s) from each HLL++ sketch.
When extracting from an "empty sketch" represented by an byte array of length 0, the result returned is 0.
Corresponds to the HLL_COUNT.EXTRACT(sketch)
function in BigQuery.
Modifier and Type | Method and Description |
---|---|
static PTransform<PCollection<byte[]>,PCollection<java.lang.Long>> |
globally()
Returns a
PTransform that takes an input PCollection<byte[]> of HLL++
sketches and returns a PCollection<Long> of the estimated count of distinct elements
extracted from each sketch. |
static <K> PTransform<PCollection<KV<K,byte[]>>,PCollection<KV<K,java.lang.Long>>> |
perKey()
Returns a
PTransform that takes an input PCollection<KV<K, byte[]>> of (key,
HLL++ sketch) pairs and returns a PCollection<KV<K, Long>> of (key, estimated count
of distinct elements extracted from each sketch). |
public static PTransform<PCollection<byte[]>,PCollection<java.lang.Long>> globally()
PTransform
that takes an input PCollection<byte[]>
of HLL++
sketches and returns a PCollection<Long>
of the estimated count of distinct elements
extracted from each sketch.
Returns 0 if the input element is an "empty sketch" (byte array of length 0).
public static <K> PTransform<PCollection<KV<K,byte[]>>,PCollection<KV<K,java.lang.Long>>> perKey()
PTransform
that takes an input PCollection<KV<K, byte[]>>
of (key,
HLL++ sketch) pairs and returns a PCollection<KV<K, Long>>
of (key, estimated count
of distinct elements extracted from each sketch).