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/23 02:08:41 UTC

[GitHub] [beam] ihji commented on a change in pull request #14293: [BEAM-11862] Updates ExternalTransformFinder to consider external leaf transforms

ihji commented on a change in pull request #14293:
URL: https://github.com/apache/beam/pull/14293#discussion_r599193657



##########
File path: sdks/python/apache_beam/transforms/external_test.py
##########
@@ -259,6 +259,33 @@ def test_unique_name(self):
     self.assertEqual(
         len(set(pcolls)), len(pcolls), msg='PCollection names are not unique.')
 
+  def test_external_transform_finder_non_leaf(self):
+    pipeline = beam.Pipeline()
+    _ = (
+        pipeline
+        | beam.Create(['a', 'b'])
+        | beam.ExternalTransform(
+            'beam:transforms:xlang:test:prefix',
+            ImplicitSchemaPayloadBuilder({'data': u'0'}),
+            expansion_service.ExpansionServiceServicer())
+        | beam.FlatMap(lambda x: x))

Review comment:
       `FlatMap` [needs](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/core.py#L1532) to return an iterable of elements. It might just work as it expands strings to characters and output is not important in this test.

##########
File path: sdks/python/apache_beam/runners/portability/expansion_service_test.py
##########
@@ -296,6 +299,27 @@ def from_runner_api_parameter(unused_ptransform, level, unused_context):
     return FibTransform(int(level.decode('ascii')))
 
 
+@ptransform.PTransform.register_urn(TEST_NO_OUTPUT_URN, None)
+class NoOutputTransform(ptransform.PTransform):
+  def __init__(self, payload):
+    self._payload = payload

Review comment:
       Looks like `_payload` is not used, any reason to keep it?




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