T - type of element being comparedpublic static class Top.TopCombineFn<T,ComparatorT extends Comparator<T> & Serializable> extends Combine.AccumulatingCombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT>,List<T>>
CombineFn for Top transforms that combines a
bunch of Ts into a single count-long
List<T>, using compareFn to choose the largest
Ts.Combine.AccumulatingCombineFn.Accumulator<InputT,AccumT,OutputT>| Constructor and Description |
|---|
TopCombineFn(int count,
ComparatorT compareFn) |
| Modifier and Type | Method and Description |
|---|---|
com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT> |
createAccumulator()
Returns a new, mutable accumulator value, representing the
accumulation of zero input values.
|
Coder<com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT>> |
getAccumulatorCoder(CoderRegistry registry,
Coder<T> 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 TopCombineFn(int count,
ComparatorT compareFn)
public com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT> createAccumulator()
Combine.CombineFncreateAccumulator in class Combine.CombineFn<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT extends Comparator<T> & Serializable>,List<T>>public Coder<com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT>> getAccumulatorCoder(CoderRegistry registry, Coder<T> 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<T,com.google.cloud.dataflow.sdk.transforms.Top.BoundedHeap<T,ComparatorT extends Comparator<T> & Serializable>,List<T>>