InputT
- the type of the elements in the input PCollection
public static class ApproximateDistinct.ApproximateDistinctFn<InputT>
extends org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>
Combine.CombineFn
of ApproximateDistinct
transforms.Modifier and Type | Method and Description |
---|---|
com.clearspring.analytics.stream.cardinality.HyperLogLogPlus |
addInput(com.clearspring.analytics.stream.cardinality.HyperLogLogPlus acc,
InputT record) |
static <InputT> ApproximateDistinct.ApproximateDistinctFn<InputT> |
create(org.apache.beam.sdk.coders.Coder<InputT> coder)
Returns an
ApproximateDistinct.ApproximateDistinctFn combiner with the given input coder. |
com.clearspring.analytics.stream.cardinality.HyperLogLogPlus |
createAccumulator() |
com.clearspring.analytics.stream.cardinality.HyperLogLogPlus |
extractOutput(com.clearspring.analytics.stream.cardinality.HyperLogLogPlus accumulator)
Output the whole structure so it can be queried, reused or stored easily.
|
com.clearspring.analytics.stream.cardinality.HyperLogLogPlus |
mergeAccumulators(java.lang.Iterable<com.clearspring.analytics.stream.cardinality.HyperLogLogPlus> accumulators) |
void |
populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder) |
ApproximateDistinct.ApproximateDistinctFn<InputT> |
withPrecision(int p)
Returns an
ApproximateDistinct.ApproximateDistinctFn combiner with a new precision p . |
ApproximateDistinct.ApproximateDistinctFn<InputT> |
withSparseRepresentation(int sp)
Returns an
ApproximateDistinct.ApproximateDistinctFn combiner with a new sparse representation's
precision sp . |
public static <InputT> ApproximateDistinct.ApproximateDistinctFn<InputT> create(org.apache.beam.sdk.coders.Coder<InputT> coder)
ApproximateDistinct.ApproximateDistinctFn
combiner with the given input coder.coder
- the coder that encodes the elements' typepublic ApproximateDistinct.ApproximateDistinctFn<InputT> withPrecision(int p)
ApproximateDistinct.ApproximateDistinctFn
combiner with a new precision p
.
Keep in mind that p
cannot be lower than 4, because the estimation would be too
inaccurate.
See ApproximateDistinct.precisionForRelativeError(double)
and ApproximateDistinct.relativeErrorForPrecision(int)
to have more information about the
relationship between precision and relative error.
p
- the precision value for the normal representationpublic ApproximateDistinct.ApproximateDistinctFn<InputT> withSparseRepresentation(int sp)
ApproximateDistinct.ApproximateDistinctFn
combiner with a new sparse representation's
precision sp
.
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.
sp
- the precision of HyperLogLog+' sparse representationpublic com.clearspring.analytics.stream.cardinality.HyperLogLogPlus createAccumulator()
createAccumulator
in class org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>
public com.clearspring.analytics.stream.cardinality.HyperLogLogPlus addInput(com.clearspring.analytics.stream.cardinality.HyperLogLogPlus acc, InputT record)
addInput
in class org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>
public com.clearspring.analytics.stream.cardinality.HyperLogLogPlus extractOutput(com.clearspring.analytics.stream.cardinality.HyperLogLogPlus accumulator)
extractOutput
in class org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>
public com.clearspring.analytics.stream.cardinality.HyperLogLogPlus mergeAccumulators(java.lang.Iterable<com.clearspring.analytics.stream.cardinality.HyperLogLogPlus> accumulators)
mergeAccumulators
in class org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>
public void populateDisplayData(org.apache.beam.sdk.transforms.display.DisplayData.Builder builder)
populateDisplayData
in interface org.apache.beam.sdk.transforms.display.HasDisplayData
populateDisplayData
in class org.apache.beam.sdk.transforms.Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>