This is an automated email from the ASF dual-hosted git repository. damccorm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push: new 6561abf7beb Update groupbykey.py (#32359) 6561abf7beb is described below commit 6561abf7beb3d19e4ff4fa9726c4351b9019c1ab Author: Christoph Grotz <gr...@google.com> AuthorDate: Thu Oct 3 17:37:56 2024 +0200 Update groupbykey.py (#32359) The original example was not actually counting the produce but grouping the produce per season. Maybe it's better to rename the variables to reflect this, in order to not confuse the reader. --- .../examples/snippets/transforms/aggregation/groupbykey.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey.py b/sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey.py index aca39f6a219..a2d32b564a3 100644 --- a/sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey.py +++ b/sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey.py @@ -40,9 +40,9 @@ def groupbykey(test=None): import apache_beam as beam with beam.Pipeline() as pipeline: - produce_counts = ( + produce_per_season = ( pipeline - | 'Create produce counts' >> beam.Create([ + | 'Create produce list' >> beam.Create([ ('spring', '🍓'), ('spring', '🥕'), ('spring', '🍆'), @@ -54,12 +54,12 @@ def groupbykey(test=None): ('fall', '🍅'), ('winter', '🍆'), ]) - | 'Group counts per produce' >> beam.GroupByKey() + | 'Group produce per season' >> beam.GroupByKey() | beam.MapTuple(lambda k, vs: (k, sorted(vs))) # sort and format | beam.Map(print)) # [END groupbykey] if test: - test(produce_counts) + test(produce_per_season) if __name__ == '__main__':