NumT - the type of the Numbers being combinedpublic static class Mean.MeanFn<NumT extends Number> extends Combine.AccumulatingCombineFn<NumT,com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum,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 Double.NaN if combining zero elements.
Combine.AccumulatingCombineFn.Accumulator<InputT,AccumT,OutputT>| 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<NumT> inputCoder)
Returns the
Coder to use for accumulator AccumT
values, or null if it is not able to be inferred. |
addInput, extractOutput, mergeAccumulatorsapply, asKeyedFn, getDefaultOutputCoder, getOutputTypepublic Mean.MeanFn()
N.public com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<NumT extends Number,com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum,Double>public Coder<com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum> getAccumulatorCoder(CoderRegistry registry, Coder<NumT> inputCoder)
Combine.CombineFnCoder to use for accumulator AccumT
values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being used
for InputT values and the enclosing Pipeline's
CoderRegistry to try to infer the Coder for AccumT
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<NumT extends Number,com.google.cloud.dataflow.sdk.transforms.Mean.MeanFn.CountSum,Double>