Class ApproximateDistinct.PerKeyDistinct<K,V>
- java.lang.Object
-
- org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,V>>,org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,java.lang.Long>>>
-
- org.apache.beam.sdk.extensions.sketching.ApproximateDistinct.PerKeyDistinct<K,V>
-
- Type Parameters:
K- type of the keys mapping the elementsV- type of the values being combined per key
- All Implemented Interfaces:
java.io.Serializable,org.apache.beam.sdk.transforms.display.HasDisplayData
- Enclosing class:
- ApproximateDistinct
public abstract static class ApproximateDistinct.PerKeyDistinct<K,V> extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,V>>,org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,java.lang.Long>>>Implementation ofApproximateDistinct.perKey().- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PerKeyDistinct()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,java.lang.Long>>expand(org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<K,V>> input)ApproximateDistinct.PerKeyDistinct<K,V>withPrecision(int p)Sets the precisionp.ApproximateDistinct.PerKeyDistinct<K,V>withSparsePrecision(int sp)Sets the sparse representation's precisionsp.-
Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
-
-
-
Method Detail
-
withPrecision
public ApproximateDistinct.PerKeyDistinct<K,V> withPrecision(int p)
Sets the precisionp.Keep in mind that
pcannot be lower than 4, because the estimation would be too inaccurate.See
ApproximateDistinct.precisionForRelativeError(double)andApproximateDistinct.relativeErrorForPrecision(int)to have more information about the relationship between precision and relative error.- Parameters:
p- the precision value for the normal representation
-
withSparsePrecision
public ApproximateDistinct.PerKeyDistinct<K,V> withSparsePrecision(int sp)
Sets the sparse representation's precisionsp.Values above 32 are not yet supported by the AddThis version of HyperLogLog+.
Fore more information about the sparse representation, read Google's paper available here.
- Parameters:
sp- the precision of HyperLogLog+' sparse representation
-
-