Class RichGroupReduceFunction<IN,OUT>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.api.common.functions.RichGroupReduceFunction<IN,OUT>
-
- Type Parameters:
IN
- Type of the elements that this function processes.OUT
- The type of the elements returned by the user-defined function.
- All Implemented Interfaces:
Serializable
,Function
,GroupReduceFunction<IN,OUT>
,RichFunction
- Direct Known Subclasses:
OperatorSubtaskStateReducer
@Public public abstract class RichGroupReduceFunction<IN,OUT> extends AbstractRichFunction implements GroupReduceFunction<IN,OUT>
Rich variant of theGroupReduceFunction
. As aRichFunction
, it gives access to theRuntimeContext
and provides setup and teardown methods:RichFunction.open(OpenContext)
andRichFunction.close()
.Partial computation can significantly improve the performance of a
RichGroupReduceFunction
. This technique is also known as applying a Combiner. Implement theGroupCombineFunction
interface to enable partial computation, i.e., a combiner for thisRichGroupReduceFunction
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RichGroupReduceFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
reduce(Iterable<IN> values, Collector<OUT> out)
The reduce method.-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
-
-
-
-
Method Detail
-
reduce
public abstract void reduce(Iterable<IN> values, Collector<OUT> out) throws Exception
Description copied from interface:GroupReduceFunction
The reduce method. The function receives one call per group of elements.- Specified by:
reduce
in interfaceGroupReduceFunction<IN,OUT>
- Parameters:
values
- All records that belong to the given input key.out
- The collector to hand results to.- Throws:
Exception
- This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
-
-