Class HllCount.Extract
java.lang.Object
org.apache.beam.sdk.extensions.zetasketch.HllCount.Extract
- Enclosing class:
HllCount
Provides
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PTransform
<PCollection<byte[]>, PCollection<Long>> globally()
Returns aPTransform
that takes an inputPCollection<byte[]>
of HLL++ sketches and returns aPCollection<Long>
of the estimated count of distinct elements extracted from each sketch.static <K> PTransform
<PCollection<KV<K, byte[]>>, PCollection<KV<K, Long>>> perKey()
Returns aPTransform
that takes an inputPCollection<KV<K, byte[]>>
of (key, HLL++ sketch) pairs and returns aPCollection<KV<K, Long>>
of (key, estimated count of distinct elements extracted from each sketch).
-
Method Details
-
globally
Returns aPTransform
that takes an inputPCollection<byte[]>
of HLL++ sketches and returns aPCollection<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).
-
perKey
Returns aPTransform
that takes an inputPCollection<KV<K, byte[]>>
of (key, HLL++ sketch) pairs and returns aPCollection<KV<K, Long>>
of (key, estimated count of distinct elements extracted from each sketch).
-