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
@Public public abstract class RichGroupReduceFunction<IN,OUT> extends AbstractRichFunction implements GroupReduceFunction<IN,OUT>
Rich variant of theGroupReduceFunction. As aRichFunction, it gives access to theRuntimeContextand 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 theGroupCombineFunctioninterface 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 voidreduce(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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.common.functions.RichFunction
open
-
-
-
-
Method Detail
-
reduce
public abstract void reduce(Iterable<IN> values, Collector<OUT> out) throws Exception
Description copied from interface:GroupReduceFunctionThe reduce method. The function receives one call per group of elements.- Specified by:
reducein 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.
-
-