Class HllCount.MergePartial
- Enclosing class:
HllCount
PTransforms to merge HLL++ sketches into a new sketch.
Only sketches of the same type can be merged together. If incompatible sketches are provided, a runtime error will occur.
If sketches of different precisions are merged, the merged sketch will get the
minimum precision encountered among all the input sketches.
An "empty sketch" represented by an byte array of length 0 is returned if the input
PCollection is empty.
Corresponds to the HLL_COUNT.MERGE_PARTIAL(sketch) function in BigQuery.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Combine.Globally<byte @Nullable [], byte[]> globally()Returns aCombine.GloballyPTransformthat takes an inputPCollection<byte[]>of HLL++ sketches and returns aPCollection<byte[]>of a new sketch merged from the input sketches.static <K> Combine.PerKey<K, byte @Nullable [], byte[]> perKey()Returns aCombine.PerKeyPTransformthat takes an inputPCollection<KV<K, byte[]>>of (key, HLL++ sketch) pairs and returns aPCollection<KV<K, byte[]>>of (key, new sketch merged from the input sketches under the key).
-
Method Details
-
globally
Returns aCombine.GloballyPTransformthat takes an inputPCollection<byte[]>of HLL++ sketches and returns aPCollection<byte[]>of a new sketch merged from the input sketches.Only sketches of the same type can be merged together. If incompatible sketches are provided, a runtime error will occur.
If sketches of different
precisions are merged, the merged sketch will get the minimum precision encountered among all the input sketches.Returns a singleton
PCollectionwith an "empty sketch" (byte array of length 0) if the inputPCollectionis empty. -
perKey
Returns aCombine.PerKeyPTransformthat takes an inputPCollection<KV<K, byte[]>>of (key, HLL++ sketch) pairs and returns aPCollection<KV<K, byte[]>>of (key, new sketch merged from the input sketches under the key).If sketches of different
precisions are merged, the merged sketch will get the minimum precision encountered among all the input sketches.Only sketches of the same type can be merged together. If incompatible sketches are provided, a runtime error will occur.
-