public abstract static class Combine.BinaryCombineDoubleFn extends Combine.CombineFn<Double,double[],Double> implements com.google.cloud.dataflow.sdk.util.common.CounterProvider<Double>
Combine.CombineFn for implementing combiners that are more
easily expressed as binary operations on doubles.| Constructor and Description |
|---|
BinaryCombineDoubleFn() |
| Modifier and Type | Method and Description |
|---|---|
double[] |
addInput(double[] accumulator,
Double input)
Adds the given input value to the given accumulator, returning the
new accumulator value.
|
abstract double |
apply(double left,
double right)
Applies the binary operation to the two operands, returning the result.
|
double[] |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
Double |
extractOutput(double[] accumulator)
Returns the output value that is the result of combining all
the input values represented by the given accumulator.
|
Coder<double[]> |
getAccumulatorCoder(CoderRegistry registry,
Coder<Double> inputCoder)
Returns the
Coder to use for accumulator AccumT
values, or null if it is not able to be inferred. |
Coder<Double> |
getDefaultOutputCoder(CoderRegistry registry,
Coder<Double> inputCoder)
Returns the
Coder to use by default for output
OutputT values, or null if it is not able to be inferred. |
abstract double |
identity()
Returns the identity element of this operation, i.e.
|
double[] |
mergeAccumulators(Iterable<double[]> accumulators)
Returns an accumulator representing the accumulation of all the
input values accumulated in the merging accumulators.
|
apply, asKeyedFn, getOutputTypepublic abstract double apply(double left,
double right)
public abstract double identity()
e
such that apply(e, x) == apply(x, e) == x for all values of x.public double[] createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<Double,double[],Double>public double[] addInput(double[] accumulator,
Double input)
Combine.CombineFnFor efficiency, the input accumulator may be modified and returned.
addInput in class Combine.CombineFn<Double,double[],Double>public double[] mergeAccumulators(Iterable<double[]> accumulators)
Combine.CombineFnMay modify any of the argument accumulators. May return a fresh accumulator, or may return one of the (modified) argument accumulators.
mergeAccumulators in class Combine.CombineFn<Double,double[],Double>public Double extractOutput(double[] accumulator)
Combine.CombineFnextractOutput in class Combine.CombineFn<Double,double[],Double>public Coder<double[]> getAccumulatorCoder(CoderRegistry registry, Coder<Double> 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<Double,double[],Double>public Coder<Double> getDefaultOutputCoder(CoderRegistry registry, Coder<Double> inputCoder)
Combine.CombineFnCoder to use by default for output
OutputT values, or null if it is not able to be inferred.
By default, uses the knowledge of the Coder being
used for input InputT values and the enclosing
Pipeline's CoderRegistry to try to infer the
Coder for OutputT values.
getDefaultOutputCoder in class Combine.CombineFn<Double,double[],Double>