You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by tv...@apache.org on 2022/09/27 02:50:14 UTC

[beam] branch master updated: Changes CoGroupByKey typehint from List to Iterable (#22984)

This is an automated email from the ASF dual-hosted git repository.

tvalentyn 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 44992427a18 Changes CoGroupByKey typehint from List to Iterable (#22984)
44992427a18 is described below

commit 44992427a18e71d286d7d92ed71533fc7f05244c
Author: Ryan Thompson <ry...@gmail.com>
AuthorDate: Mon Sep 26 22:50:04 2022 -0400

    Changes CoGroupByKey typehint from List to Iterable (#22984)
    
    Co-authored-by: Lukasz Cwik <lc...@google.com>
---
 CHANGES.md                                 | 2 +-
 sdks/python/apache_beam/transforms/util.py | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 0932d8ed8c3..e04d6c5852b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -68,7 +68,7 @@
 
 ## Breaking Changes
 
-* X behavior was changed ([#X](https://github.com/apache/beam/issues/X)).
+* Python SDK CoGroupByKey outputs an iterable allowing for arbitrarily large results. [#21556](https://github.com/apache/beam/issues/21556) Beam users may see an error on transforms downstream from CoGroupByKey. Users must change methods expecting a List to expect an Iterable going forward. See [document](https://docs.google.com/document/d/1RIzm8-g-0CyVsPb6yasjwokJQFoKHG4NjRUcKHKINu0) for information and fixes.
 
 ## Deprecations
 
diff --git a/sdks/python/apache_beam/transforms/util.py b/sdks/python/apache_beam/transforms/util.py
index 13d68df3715..cb4b86245e0 100644
--- a/sdks/python/apache_beam/transforms/util.py
+++ b/sdks/python/apache_beam/transforms/util.py
@@ -198,8 +198,7 @@ class CoGroupByKey(PTransform):
       input_value_types.append(value_type)
     output_key_type = typehints.Union[tuple(input_key_types)]
     iterable_input_value_types = tuple(
-        # TODO: Change List[t] to Iterable[t]
-        typehints.List[t] for t in input_value_types)
+        typehints.Iterable[t] for t in input_value_types)
 
     output_value_type = typehints.Dict[
         str, typehints.Union[iterable_input_value_types or [typehints.Any]]]