Takes a keyed collection of elements and produces a collection where
each element consists of a key and an
Iterable of all values
associated with that key.
The results can be combined with windowing to subdivide each key based on time or triggering to produce partial aggregations. Either windowing or triggering is necessary when processing unbounded collections.
See more information in the Beam Programming Guide.
Example 1: (a, 1), (b, 2), (a, 3) will result into (a, [1, 3]), (b, ).
Example 2: Given a collection of customer orders keyed by postal code,
you could use
GroupByKey to get the collection of all orders in each postal code.
- CoGroupByKey for multiple input collections
- Combine for combining all values associated with a key to a single result
Last updated on 2022/12/21
Have you found everything you were looking for?
Was it all useful and clear? Is there anything that you would like to change? Let us know!