Combine - Simple Function

Combine is a Beam transform for combining collections of elements or values in your data. When you apply a Combine transform, you must provide the function that contains the logic for combining the elements or values. The combining function should be commutative and associative, as the function is not necessarily invoked exactly once on all values with a given key. Because the input data (including the value collection) may be distributed across multiple workers, the combining function might be called multiple times to perform partial combining on subsets of the value collection.

Simple combine operations, such as sums, can usually be implemented as a simple function.

Kata: Implement the summation of numbers using Combine.globally(SerializableFunction).


Implement the SerializableFunction.apply method that performs the summation of the Iterable.
Refer to the Beam Programming Guide "Simple combinations using simple functions" section for more information.