T- Type of the initial input and the returned element
O- Type of the elements that the group/list/stream contains
@Public 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
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–2017 The Apache Software Foundation. All rights reserved.