You can use the BinaryCombineFn subclass, which only requires implementing the (V, V) => V operation. There's also the IterableCombineFn which is defined in terms of an Iterable<V> => V.
On Fri, Apr 26, 2019 at 12:53 AM Nikhil Goyal <[email protected]> wrote: > > Hi guys, > > Given a PCollection<K, V> and a method (V, V) => V, is there a way to reduce > the Key Value pairs? > I see there is GroupBy which returns Iterator<V> and it might not be cost > effective. The combine method requires to implement interface CombineFn which > makes the code go extremely verbose. I was wondering if we have something > similar to spark api of reduce in beam as well. > > Thanks > Nikhil
