IN
- Type of the elements that this function processes.OUT
- The type of the elements returned by the user-defined function.@Public public abstract class RichGroupReduceFunction<IN,OUT> extends AbstractRichFunction implements GroupReduceFunction<IN,OUT>
GroupReduceFunction
. As a RichFunction
, it gives access to
the RuntimeContext
and provides setup and teardown
methods: RichFunction.open(org.apache.flink.configuration.Configuration)
and RichFunction.close()
.
Partial computation can significantly improve the performance of a RichGroupReduceFunction
. This technique is also known as applying a Combiner. Implement the
GroupCombineFunction
interface to enable partial computation, i.e., a combiner for this
RichGroupReduceFunction
.
Constructor and Description |
---|
RichGroupReduceFunction() |
Modifier and Type | Method and Description |
---|---|
abstract void |
reduce(Iterable<IN> values,
Collector<OUT> out)
The reduce method.
|
close, getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
public abstract void reduce(Iterable<IN> values, Collector<OUT> out) throws Exception
GroupReduceFunction
reduce
in interface GroupReduceFunction<IN,OUT>
values
- All records that belong to the given input key.out
- The collector to hand results to.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.