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 T
s into a single
count
-long List<T>
, using compareFn
to choose the largest T
s.- 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 theTypeVariable
ofAccumT
.Coder
<org.apache.beam.sdk.transforms.Top.BoundedHeap<T, ComparatorT>> getAccumulatorCoder
(CoderRegistry registry, Coder<T> inputCoder) Returns theCoder
to use for accumulatorAccumT
values, or null if it is not able to be inferred.getDefaultOutputCoder
(CoderRegistry registry, Coder<T> inputCoder) Returns theCoder
to use by default for outputOutputT
values, or null if it is not able to be inferred.Returns the error message for not supported default values in Combine.globally().TypeVariable
<?> Returns theTypeVariable
ofInputT
.TypeVariable
<?> Returns theTypeVariable
ofOutputT
.void
populateDisplayData
(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, mergeAccumulators
Methods inherited from class org.apache.beam.sdk.transforms.Combine.CombineFn
apply, compact, defaultValue, getInputType, getOutputType
-
Constructor Details
-
TopCombineFn
-
-
Method Details
-
getNameOverride
- Specified by:
getNameOverride
in interfaceorg.apache.beam.sdk.util.NameUtils.NameOverride
-
createAccumulator
Description copied from class:Combine.CombineFn
Returns a new, mutable accumulator value, representing the accumulation of zero input values.- Specified by:
createAccumulator
in 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.GlobalCombineFn
Returns theCoder
to use for accumulatorAccumT
values, or null if it is not able to be inferred.By default, uses the knowledge of the
Coder
being used forInputT
values and the enclosingPipeline
'sCoderRegistry
to try to infer the Coder forAccumT
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.
- Specified by:
getAccumulatorCoder
in 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:
populateDisplayData
in interfaceHasDisplayData
- Parameters:
builder
- The builder to populate with display data.- See Also:
-
getIncompatibleGlobalWindowErrorMessage
Description copied from interface:CombineFnBase.GlobalCombineFn
Returns the error message for not supported default values in Combine.globally().- Specified by:
getIncompatibleGlobalWindowErrorMessage
in 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.GlobalCombineFn
Returns theCoder
to use by default for outputOutputT
values, or null if it is not able to be inferred.By default, uses the knowledge of the
Coder
being used for inputInputT
values and the enclosingPipeline
'sCoderRegistry
to try to infer the Coder forOutputT
values.- Specified by:
getDefaultOutputCoder
in interfaceCombineFnBase.GlobalCombineFn<InputT,
AccumT, OutputT> - Throws:
CannotProvideCoderException
-
getInputTVariable
Returns theTypeVariable
ofInputT
. -
getAccumTVariable
Returns theTypeVariable
ofAccumT
. -
getOutputTVariable
Returns theTypeVariable
ofOutputT
.
-