[
https://issues.apache.org/jira/browse/BEAM-7961?focusedWorklogId=368368&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-368368
]
ASF GitHub Bot logged work on BEAM-7961:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Jan/20 19:48
Start Date: 08/Jan/20 19:48
Worklog Time Spent: 10m
Work Description: chamikaramj 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_r364404753
##########
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:
Do we need to implement from_runner_api_parameter() and
to_runner_api_parameter() methods here and below ? don't the default
implementation work ?
----------------------------------------------------------------
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: 368368)
Time Spent: 14.5h (was: 14h 20m)
> 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: 14.5h
> 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)