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