Class Top.TopCombineFn<T,ComparatorT extends Comparator<T> & Serializable>
- Type Parameters:
T- type of element being compared
- All Implemented Interfaces:
Serializable,CombineFnBase.GlobalCombineFn<T,,org.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT>, List<T>> HasDisplayData,org.apache.beam.sdk.util.NameUtils.NameOverride
- Enclosing class:
Top
CombineFn for Top transforms that combines a bunch of Ts into a single
count-long List<T>, using compareFn to choose the largest Ts.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.transforms.Combine.AccumulatingCombineFn
Combine.AccumulatingCombineFn.Accumulator<InputT,AccumT, OutputT> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT> Returns a new, mutable accumulator value, representing the accumulation of zero input values.TypeVariable<?> Returns theTypeVariableofAccumT.Coder<org.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT>> getAccumulatorCoder(CoderRegistry registry, Coder<T> inputCoder) Returns theCoderto use for accumulatorAccumTvalues, or null if it is not able to be inferred.getDefaultOutputCoder(CoderRegistry registry, Coder<T> inputCoder) Returns theCoderto use by default for outputOutputTvalues, or null if it is not able to be inferred.Returns the error message for not supported default values in Combine.globally().TypeVariable<?> Returns theTypeVariableofInputT.TypeVariable<?> Returns theTypeVariableofOutputT.voidpopulateDisplayData(DisplayData.Builder builder) Register display data for the given transform or component.Methods inherited from class org.apache.beam.sdk.transforms.Combine.AccumulatingCombineFn
addInput, extractOutput, mergeAccumulatorsMethods inherited from class org.apache.beam.sdk.transforms.Combine.CombineFn
apply, compact, defaultValue, getInputType, getOutputType
-
Constructor Details
-
TopCombineFn
-
-
Method Details
-
getNameOverride
- Specified by:
getNameOverridein interfaceorg.apache.beam.sdk.util.NameUtils.NameOverride
-
createAccumulator
Description copied from class:Combine.CombineFnReturns a new, mutable accumulator value, representing the accumulation of zero input values.- Specified by:
createAccumulatorin classCombine.CombineFn<T,org.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT extends Comparator<T> & Serializable>, List<T>>
-
getAccumulatorCoder
public Coder<org.apache.beam.sdk.transforms.Top.BoundedHeap<T,ComparatorT>> getAccumulatorCoder(CoderRegistry registry, Coder<T> inputCoder) Description copied from interface:CombineFnBase.GlobalCombineFnReturns theCoderto use for accumulatorAccumTvalues, or null if it is not able to be inferred.By default, uses the knowledge of the
Coderbeing used forInputTvalues and the enclosingPipeline'sCoderRegistryto try to infer the Coder forAccumTvalues.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.
- Specified by:
getAccumulatorCoderin interfaceCombineFnBase.GlobalCombineFn<T,org.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT extends Comparator<T> & Serializable>, List<T>>
-
populateDisplayData
Register display data for the given transform or component.populateDisplayData(DisplayData.Builder)is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData). Implementations may callsuper.populateDisplayData(builder)in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)to use the namespace of the subcomponent.By default, does not register any display data. Implementors may override this method to provide their own display data.
- Specified by:
populateDisplayDatain interfaceHasDisplayData- Parameters:
builder- The builder to populate with display data.- See Also:
-
getIncompatibleGlobalWindowErrorMessage
Description copied from interface:CombineFnBase.GlobalCombineFnReturns the error message for not supported default values in Combine.globally().- Specified by:
getIncompatibleGlobalWindowErrorMessagein interfaceCombineFnBase.GlobalCombineFn<T,org.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT extends Comparator<T> & Serializable>, List<T>>
-
getDefaultOutputCoder
public Coder<List<T>> getDefaultOutputCoder(CoderRegistry registry, Coder<T> inputCoder) throws CannotProvideCoderException Description copied from interface:CombineFnBase.GlobalCombineFnReturns theCoderto use by default for outputOutputTvalues, or null if it is not able to be inferred.By default, uses the knowledge of the
Coderbeing used for inputInputTvalues and the enclosingPipeline'sCoderRegistryto try to infer the Coder forOutputTvalues.- Specified by:
getDefaultOutputCoderin interfaceCombineFnBase.GlobalCombineFn<InputT,AccumT, OutputT> - Throws:
CannotProvideCoderException
-
getInputTVariable
Returns theTypeVariableofInputT. -
getAccumTVariable
Returns theTypeVariableofAccumT. -
getOutputTVariable
Returns theTypeVariableofOutputT.
-