T - Type of the initial input and the returned elementO - Type of the elements that the group/list/stream containsAggregateFunction instead@Public @Deprecated @FunctionalInterface public interface FoldFunction<O,T> extends Function, Serializable
The basic syntax for using a FoldFunction is as follows:
DataSet<X> input = ...;
X initialValue = ...;
DataSet<X> result = input.fold(new MyFoldFunction(), initialValue);
Like all functions, the FoldFunction needs to be serializable, as defined in Serializable.
| Modifier and Type | Method and Description |
|---|---|
T |
fold(T accumulator,
O value)
Deprecated.
The core method of FoldFunction, combining two values into one value of the same type.
|
T fold(T accumulator, O value) throws Exception
accumulator - The initial value, and accumulator.value - The value from the group to "fold" into the accumulator.Exception - This method may throw exceptions. Throwing an exception will cause the operation
to fail and may trigger recovery.Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.