Class ApproximateDistinct.GloballyDistinct<InputT>
- java.lang.Object
-
- org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,org.apache.beam.sdk.values.PCollection<java.lang.Long>>
-
- org.apache.beam.sdk.extensions.sketching.ApproximateDistinct.GloballyDistinct<InputT>
-
- Type Parameters:
InputT- the type of the elements in the inputPCollection
- All Implemented Interfaces:
java.io.Serializable,org.apache.beam.sdk.transforms.display.HasDisplayData
- Enclosing class:
- ApproximateDistinct
public abstract static class ApproximateDistinct.GloballyDistinct<InputT> extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,org.apache.beam.sdk.values.PCollection<java.lang.Long>>Implementation ofApproximateDistinct.globally().- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GloballyDistinct()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.beam.sdk.values.PCollection<java.lang.Long>expand(org.apache.beam.sdk.values.PCollection<InputT> input)ApproximateDistinct.GloballyDistinct<InputT>withPrecision(int p)Sets the precisionp.ApproximateDistinct.GloballyDistinct<InputT>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.GloballyDistinct<InputT> 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.GloballyDistinct<InputT> 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
-
expand
public org.apache.beam.sdk.values.PCollection<java.lang.Long> expand(org.apache.beam.sdk.values.PCollection<InputT> input)
- Specified by:
expandin classorg.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,org.apache.beam.sdk.values.PCollection<java.lang.Long>>
-
-