You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/03/08 22:56:36 UTC

[GitHub] [beam] robertwb commented on a change in pull request #14161: [BEAM-10409] Use annotations to control combiner packing.

robertwb commented on a change in pull request #14161:
URL: https://github.com/apache/beam/pull/14161#discussion_r589810273



##########
File path: sdks/python/apache_beam/runners/portability/fn_api_runner/translations.py
##########
@@ -1053,10 +1053,34 @@ def get_stage_key(stage):
     yield unpack_stage
 
 
-def pack_combiners(stages, context):
+def pack_combiners(stages, context, can_pack=None):
   # type: (Iterable[Stage], TransformContext) -> Iterator[Stage]
+  if can_pack is None:
+    can_pack_names = {}
+    parents = context.parents_map()
+
+    def can_pack(name):
+      if name in can_pack_names:
+        return can_pack_names[name]
+      else:
+        transform = context.components.transforms[name]
+        if python_urns.APPLY_COMBINER_PACKING in transform.annotations:
+          result = True
+        elif name in parents:
+          result = can_pack(parents[name])

Review comment:
       This annotation is meant to affect all its children. (Otherwise one would have to go in and modify each individual Combine and CombineGlobally.)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org