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