N - the type of the Numbers being combinedpublic static class Mean.MeanFn<N extends java.lang.Number> extends Combine.AccumulatingCombineFn<N,com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum,java.lang.Double>
Combine.CombineFn that computes the arithmetic mean
(a.k.a. average) of an Iterable of numbers of type
N, useful as an argument to Combine.globally(com.google.cloud.dataflow.sdk.transforms.SerializableFunction<java.lang.Iterable<V>, V>) or
Combine.perKey(com.google.cloud.dataflow.sdk.transforms.SerializableFunction<java.lang.Iterable<V>, V>).
Returns 0 if combining zero elements.
Combine.AccumulatingCombineFn.Accumulator<VI,VA,VO>| Constructor and Description |
|---|
Mean.MeanFn()
Constructs a combining function that computes the mean over
a collection of values of type
N. |
| Modifier and Type | Method and Description |
|---|---|
com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
Coder<com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum> |
getAccumulatorCoder(CoderRegistry registry,
Coder<N> inputCoder)
Returns the
Coder to use for accumulator VA
values, or null if it is not able to be inferred. |
addInput, extractOutput, mergeAccumulatorsapply, asKeyedFn, getDefaultOutputCoderpublic Mean.MeanFn()
N.public com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<N extends java.lang.Number,com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum,java.lang.Double>public Coder<com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum> getAccumulatorCoder(CoderRegistry registry, Coder<N> inputCoder)
Combine.CombineFnCoder to use for accumulator VA
values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being used
for VI values and the enclosing Pipeline's
CoderRegistry to try to infer the Coder for VA
values.
This is the Coder used to send data through a communication-intensive shuffle step, so a compact and efficient representation may have significant performance benefits.
getAccumulatorCoder in class Combine.CombineFn<N extends java.lang.Number,com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum,java.lang.Double>