[
https://issues.apache.org/jira/browse/BEAM-7961?focusedWorklogId=375953&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-375953
]
ASF GitHub Bot logged work on BEAM-7961:
----------------------------------------
Author: ASF GitHub Bot
Created on: 22/Jan/20 22:37
Start Date: 22/Jan/20 22:37
Worklog Time Spent: 10m
Work Description: ihji commented on pull request #10051: [BEAM-7961] Add
tests for all runner native transforms for XLang
URL: https://github.com/apache/beam/pull/10051#discussion_r369843663
##########
File path:
sdks/python/apache_beam/runners/portability/expansion_service_test.py
##########
@@ -73,39 +84,139 @@ def from_runner_api_parameter(payload, unused_context):
return FilterLessThanTransform(payload.decode('utf8'))
[email protected]_urn('simple', None)
-class SimpleTransform(ptransform.PTransform):
[email protected]_urn(TEST_PREFIX_URN, None)
[email protected]_output_types(unicode)
+class PrefixTransform(ptransform.PTransform):
+ def __init__(self, payload):
+ self._payload = payload
+
def expand(self, pcoll):
- return pcoll | 'TestLabel' >> beam.Map(lambda x: 'Simple(%s)' % x)
+ return pcoll | 'TestLabel' >> beam.Map(
+ lambda x: '{}{}'.format(self._payload, x))
def to_runner_api_parameter(self, unused_context):
- return 'simple', None
+ return TEST_PREFIX_URN, None
@staticmethod
- def from_runner_api_parameter(unused_parameter, unused_context):
- return SimpleTransform()
+ def from_runner_api_parameter(payload, unused_context):
+ return PrefixTransform(payload.decode('utf8'))
[email protected]_urn('multi', None)
[email protected]_urn(TEST_MULTI_URN, None)
class MutltiTransform(ptransform.PTransform):
def expand(self, pcolls):
return {
'main':
(pcolls['main1'], pcolls['main2'])
| beam.Flatten()
| beam.Map(lambda x, s: x + s,
- beam.pvalue.AsSingleton(pcolls['side'])),
- 'side': pcolls['side'] | beam.Map(lambda x: x + x),
+ beam.pvalue.AsSingleton(pcolls['side'])
+ ).with_output_types(unicode),
+ 'side': pcolls['side'] | beam.Map(
+ lambda x: x + x).with_output_types(unicode),
}
def to_runner_api_parameter(self, unused_context):
- return 'multi', None
+ return TEST_MULTI_URN, None
@staticmethod
def from_runner_api_parameter(unused_parameter, unused_context):
return MutltiTransform()
[email protected]_urn(TEST_GBK_URN, None)
+class GBKTransform(ptransform.PTransform):
+ def expand(self, pcoll):
+ return pcoll | 'TestLabel' >> beam.GroupByKey()
+
+ def to_runner_api_parameter(self, unused_context):
+ return TEST_GBK_URN, None
+
+ @staticmethod
+ def from_runner_api_parameter(unused_parameter, unused_context):
Review comment:
Default implementation won't work in most cases. It's more like a
placeholder not supposed to handle any generic uses.
https://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/ptransform.py#L704
----------------------------------------------------------------
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: 375953)
Time Spent: 16h 40m (was: 16.5h)
> Add tests for all runner native transforms and some widely used composite
> transforms to cross-language validates runner test suite
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: BEAM-7961
> URL: https://issues.apache.org/jira/browse/BEAM-7961
> Project: Beam
> Issue Type: Improvement
> Components: testing
> Reporter: Heejong Lee
> Assignee: Heejong Lee
> Priority: Major
> Time Spent: 16h 40m
> Remaining Estimate: 0h
>
> Add tests for all runner native transforms and some widely used composite
> transforms to cross-language validates runner test suite
--
This message was sent by Atlassian Jira
(v8.3.4#803005)