[ 
https://issues.apache.org/jira/browse/BEAM-9692?focusedWorklogId=432836&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-432836
 ]

ASF GitHub Bot logged work on BEAM-9692:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/May/20 21:15
            Start Date: 13/May/20 21:15
    Worklog Time Spent: 10m 
      Work Description: rohdesamuel commented on a change in pull request 
#11503:
URL: https://github.com/apache/beam/pull/11503#discussion_r424735647



##########
File path: sdks/python/apache_beam/runners/direct/direct_runner.py
##########
@@ -234,7 +234,89 @@ def get_replacement_transform(self, transform):
       from apache_beam.runners.direct.test_stream_impl import 
_ExpandableTestStream
       return _ExpandableTestStream(transform)
 
+  class GroupByKeyPTransformOverride(PTransformOverride):
+    """A ``PTransformOverride`` for ``GroupByKey``.
+
+    This replaces the Beam implementation as a primitive.
+    """
+    def matches(self, applied_ptransform):
+      # Imported here to avoid circular dependencies.
+      # pylint: disable=wrong-import-order, wrong-import-position
+      from apache_beam.transforms.core import GroupByKey
+      if (isinstance(applied_ptransform.transform, GroupByKey) and
+          not getattr(applied_ptransform.transform, 'override', False)):
+        self.input_type = applied_ptransform.inputs[0].element_type
+        return True
+      return False
+
+    def get_replacement_transform(self, ptransform):
+      # Imported here to avoid circular dependencies.
+      # pylint: disable=wrong-import-order, wrong-import-position
+      from apache_beam.transforms.core import GroupByKey
+
+      # Subclass from GroupByKey to inherit all the proper methods.

Review comment:
       Yep, I took out the subclass dependency and simplified the override




----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 432836)
    Time Spent: 3.5h  (was: 3h 20m)

> Clean Python DataflowRunner to use portable pipelines
> -----------------------------------------------------
>
>                 Key: BEAM-9692
>                 URL: https://issues.apache.org/jira/browse/BEAM-9692
>             Project: Beam
>          Issue Type: Improvement
>          Components: runner-dataflow
>            Reporter: Sam Rohde
>            Assignee: Sam Rohde
>            Priority: Major
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to