[
https://issues.apache.org/jira/browse/BEAM-11357?focusedWorklogId=562507&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-562507
]
ASF GitHub Bot logged work on BEAM-11357:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Mar/21 18:17
Start Date: 08/Mar/21 18:17
Worklog Time Spent: 10m
Work Description: yifanmai commented on a change in pull request #14160:
URL: https://github.com/apache/beam/pull/14160#discussion_r589641337
##########
File path: sdks/python/apache_beam/pipeline.py
##########
@@ -1028,6 +1032,26 @@ def __init__(
self.parts = [] # type: List[AppliedPTransform]
self.environment_id = environment_id if environment_id else None # type:
Optional[str]
+ if annotations is None and transform:
+
+ def annotation_to_bytes(key, a: Any) -> bytes:
+ if isinstance(a, bytes):
+ return a
+ elif isinstance(a, str):
+ return a.encode('ascii')
Review comment:
Why is this ASCII instead of UTF-8?
##########
File path: sdks/python/apache_beam/pipeline.py
##########
@@ -1028,6 +1032,26 @@ def __init__(
self.parts = [] # type: List[AppliedPTransform]
self.environment_id = environment_id if environment_id else None # type:
Optional[str]
+ if annotations is None and transform:
Review comment:
For my knowledge, why do we need to check `transform` here?
##########
File path: sdks/python/apache_beam/pipeline_test.py
##########
@@ -924,6 +924,35 @@ def test_requirements(self):
common_urns.requirements.REQUIRES_BUNDLE_FINALIZATION.urn,
proto.requirements)
+ def test_annotations(self):
+ class EmptyTransform(beam.PTransform):
+ def expand(self, pcoll):
+ return pcoll
+
+ def annotations(self):
+ return {'foo': 'some_string'}
+
+ class NonEmptyTransform(beam.PTransform):
+ def expand(self, pcoll):
+ return pcoll | beam.Map(lambda x: x)
+
+ def annotations(self):
+ return {'foo': b'some_bytes'}
+
+ p = beam.Pipeline()
+ _ = p | beam.Create([]) | EmptyTransform() | NonEmptyTransform()
Review comment:
Add test to cover the Proto code path?
----------------------------------------------------------------
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: 562507)
Time Spent: 6h (was: 5h 50m)
> Support for annotations for transforms in Go SDK
> ------------------------------------------------
>
> Key: BEAM-11357
> URL: https://issues.apache.org/jira/browse/BEAM-11357
> Project: Beam
> Issue Type: New Feature
> Components: beam-model
> Reporter: Mirac Vuslat Basaran
> Priority: P3
> Time Spent: 6h
> Remaining Estimate: 0h
>
> See the [mail
> thread|https://lists.apache.org/thread.html/ra4f90560ac82bdbedfef36b3cd508da70ee7cf23383a0451d3875e45%40%3Cdev.beam.apache.org%3E]
> for a detailed explanation of the proposal.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)