robertwb commented on a change in pull request #11270: [BEAM-9639][BEAM-9608] 
Improvements for FnApiRunner
URL: https://github.com/apache/beam/pull/11270#discussion_r407666877
 
 

 ##########
 File path: 
sdks/python/apache_beam/runners/portability/fn_api_runner/translations.py
 ##########
 @@ -149,15 +155,26 @@ def no_overlap(a, b):
     return (
         not consumer.forced_root and not self in consumer.must_follow and
         not self.is_runner_urn(context) and
-        not consumer.is_runner_urn(context) and
-        no_overlap(self.downstream_side_inputs, consumer.side_inputs()))
+        not consumer.is_runner_urn(context) and no_overlap(
+            set(self.downstream_side_inputs.keys()),
+            {i
+             for i, _, _ in consumer.side_inputs()}))
+
+  def _fuse_downstream_side_inputs(self, other):
+    res = dict(self.downstream_side_inputs)
+    for si, other_si_ids in other.downstream_side_inputs.items():
+      if si in res:
+        res[si] = union(res[si], other_si_ids)
+      else:
+        res[si] = other_si_ids
+    return res
 
   def fuse(self, other):
     # type: (Stage) -> Stage
     return Stage(
         "(%s)+(%s)" % (self.name, other.name),
         self.transforms + other.transforms,
-        union(self.downstream_side_inputs, other.downstream_side_inputs),
+        self._fuse_downstream_side_inputs(other),
 
 Review comment:
   Nit: this sounds like it mutates self.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to