- class ReduceFunction[source]#
Base interface for Reduce functions. Reduce functions combine groups of elements to a single value, by taking always two elements and combining them into one. Reduce functions may be used on entire data sets, or on grouped data sets. In the latter case, each group is reduced individually.
The basic syntax for using a ReduceFunction is as follows:
>>> ds = ... >>> new_ds = ds.key_by(lambda x: x).reduce(MyReduceFunction())
The core method of ReduceFunction, combining two values into one value of the same type.