Class HllCount.Init
- Enclosing class:
HllCount
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHllCount.Init.Builder<InputT extends @Nullable Object>Builder for theHllCount.InitcombiningPTransform. -
Method Summary
Modifier and TypeMethodDescriptionstatic HllCount.Init.Builder<byte[]> forBytes()Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes bytes-type HLL++ sketches.static HllCount.Init.Builder<Integer> Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes integer-type HLL++ sketches.static HllCount.Init.Builder<Long> forLongs()Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes long-type HLL++ sketches.static HllCount.Init.Builder<String> Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes string-type HLL++ sketches.
-
Method Details
-
forIntegers
Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes integer-type HLL++ sketches. CallHllCount.Init.Builder.globally()orHllCount.Init.Builder.perKey()on the returningHllCount.Init.Builderto finalize thePTransform.Calling
HllCount.Init.Builder.globally()returns aPTransformthat takes an inputPCollection<Integer>and returns aPCollection<byte[]>which consists of the integer-type HLL++ sketch computed from the elements in the inputPCollection.Calling
HllCount.Init.Builder.perKey()returns aPTransformthat takes an inputPCollection<KV<K, Integer>>and returns aPCollection<KV<K, byte[]>>which consists of the per-key integer-type HLL++ sketch computed from the values matching each key in the inputPCollection.Integer-type sketches cannot be merged with sketches of other types.
-
forLongs
Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes long-type HLL++ sketches. CallHllCount.Init.Builder.globally()orHllCount.Init.Builder.perKey()on the returningHllCount.Init.Builderto finalize thePTransform.Calling
HllCount.Init.Builder.globally()returns aPTransformthat takes an inputPCollection<Long>and returns aPCollection<byte[]>which consists of the long-type HLL++ sketch computed from the elements in the inputPCollection.Calling
HllCount.Init.Builder.perKey()returns aPTransformthat takes an inputPCollection<KV<K, Long>>and returns aPCollection<KV<K, byte[]>>which consists of the per-key long-type HLL++ sketch computed from the values matching each key in the inputPCollection.Long-type sketches cannot be merged with sketches of other types.
-
forStrings
Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes string-type HLL++ sketches. CallHllCount.Init.Builder.globally()orHllCount.Init.Builder.perKey()on the returningHllCount.Init.Builderto finalize thePTransform.Calling
HllCount.Init.Builder.globally()returns aPTransformthat takes an inputPCollection<String>and returns aPCollection<byte[]>which consists of the string-type HLL++ sketch computed from the elements in the inputPCollection.Calling
HllCount.Init.Builder.perKey()returns aPTransformthat takes an inputPCollection<KV<K, String>>and returns aPCollection<KV<K, byte[]>>which consists of the per-key string-type HLL++ sketch computed from the values matching each key in the inputPCollection.String-type sketches cannot be merged with sketches of other types.
-
forBytes
Returns aHllCount.Init.Builderfor aHllCount.InitcombiningPTransformthat computes bytes-type HLL++ sketches. CallHllCount.Init.Builder.globally()orHllCount.Init.Builder.perKey()on the returningHllCount.Init.Builderto finalize thePTransform.Calling
HllCount.Init.Builder.globally()returns aPTransformthat takes an inputPCollection<byte[]>and returns aPCollection<byte[]>which consists of the bytes-type HLL++ sketch computed from the elements in the inputPCollection.Calling
HllCount.Init.Builder.perKey()returns aPTransformthat takes an inputPCollection<KV<K, byte[]>>and returns aPCollection<KV<K, byte[]>>which consists of the per-key bytes-type HLL++ sketch computed from the values matching each key in the inputPCollection.Bytes-type sketches cannot be merged with sketches of other types.
-