[ https://issues.apache.org/jira/browse/BEAM-8019?focusedWorklogId=414423&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-414423 ]
ASF GitHub Bot logged work on BEAM-8019: ---------------------------------------- Author: ASF GitHub Bot Created on: 02/Apr/20 01:52 Start Date: 02/Apr/20 01:52 Worklog Time Spent: 10m Work Description: chamikaramj commented on pull request #11185: [BEAM-8019] Updates Python SDK to handle remote SDK coders and preserve tags added by remote SDKs and propagate restriction coders. URL: https://github.com/apache/beam/pull/11185#discussion_r400425818 ########## File path: sdks/python/apache_beam/runners/dataflow/dataflow_runner.py ########## @@ -597,19 +611,47 @@ def _get_side_input_encoding(self, input_encoding): }, } - def _get_encoded_output_coder(self, transform_node, window_value=True): - """Returns the cloud encoding of the coder for the output of a transform.""" - from apache_beam.runners.portability.fn_api_runner.translations import \ - only_element - if len(transform_node.outputs) == 1: - output_tag = only_element(transform_node.outputs.keys()) - # TODO(robertwb): Handle type hints for multi-output transforms. + def _get_encoded_output_coder( + self, transform_node, window_value=True, output_tag=None): + """Returns the cloud encoding of the coder for the output of a transform. + + If output_tag is not specified, we assume all outputs to have the same + encoding. + """ + from apache_beam.transforms.core import RunnerAPIPTransformHolder + external_transform = isinstance( + transform_node.transform, RunnerAPIPTransformHolder) + if external_transform and not output_tag: + raise Exception('For external transforms, output_tag must be specified') + + if not output_tag: + output_tag = next(iter(transform_node.outputs.keys())) + + element_type = None + if external_transform: element_type = transform_node.outputs[output_tag].element_type + # We perform special encoding for any external coders that cannot be + # parsed in Python SDK. + if isinstance(element_type, ElementTypeHolder): + coder = self._get_encoding_for_external_environment(element_type) + if window_value: Review comment: Done. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 414423) > Support cross-language transforms for DataflowRunner > ---------------------------------------------------- > > Key: BEAM-8019 > URL: https://issues.apache.org/jira/browse/BEAM-8019 > Project: Beam > Issue Type: New Feature > Components: sdk-py-core > Reporter: Chamikara Madhusanka Jayalath > Assignee: Chamikara Madhusanka Jayalath > Priority: Major > Time Spent: 13h 50m > Remaining Estimate: 0h > > This is to capture the Beam changes needed for this task. -- This message was sent by Atlassian Jira (v8.3.4#803005)