T- Type of the elements that this function processes.
@Public @FunctionalInterface public interface ReduceFunction<T> extends Function, Serializable
For a reduce functions that work on an entire group at the same time (such as the
MapReduce/Hadoop-style reduce), see
GroupReduceFunction. In the general case,
ReduceFunctions are considered faster, because they allow the system to use more efficient
The basic syntax for using a grouped ReduceFunction is as follows:
DataSet<X> input = ...; DataSet<X> result = input.groupBy(<key-definition>).reduce(new MyReduceFunction());
Like all functions, the ReduceFunction needs to be serializable, as defined in
value1- The first value to combine.
value2- The second value to combine.
Exception- This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.