InputT - the type of the elements in the input PCollectionpublic static class ApproximateDistinct.ApproximateDistinctFn<InputT> extends 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(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(Iterable<com.clearspring.analytics.stream.cardinality.HyperLogLogPlus> accumulators) |
void |
populateDisplayData(DisplayData.Builder builder) |
ApproximateDistinct.ApproximateDistinctFn<InputT> |
withPrecision(int p)
Returns a new
ApproximateDistinct.ApproximateDistinctFn combiner with a new precision p. |
ApproximateDistinct.ApproximateDistinctFn<InputT> |
withSparseRepresentation(int sp)
Returns a new
ApproximateDistinct.ApproximateDistinctFn combiner with a sparse representation of
precision sp. |
apply, compact, defaultValue, getOutputTypepublic static <InputT> ApproximateDistinct.ApproximateDistinctFn<InputT> create(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 sparse representation of
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 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 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 Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>public com.clearspring.analytics.stream.cardinality.HyperLogLogPlus mergeAccumulators(Iterable<com.clearspring.analytics.stream.cardinality.HyperLogLogPlus> accumulators)
mergeAccumulators in class Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>public void populateDisplayData(DisplayData.Builder builder)
populateDisplayData in interface HasDisplayDatapopulateDisplayData in class Combine.CombineFn<InputT,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus,com.clearspring.analytics.stream.cardinality.HyperLogLogPlus>Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.