KevinGG commented on code in PR #17278:
URL: https://github.com/apache/beam/pull/17278#discussion_r863283190
##########
sdks/python/apache_beam/coders/typecoders.py:
##########
@@ -116,10 +116,18 @@ def register_coder(self, typehint_type,
typehint_coder_class):
'Received %r instead.' % typehint_coder_class)
if typehint_type not in self.custom_types:
self.custom_types.append(typehint_type)
+ if typehint_type.__module__ == '__main__':
+ # See https://issues.apache.org/jira/browse/BEAM-14250
+ # TODO(robertwb): Remove once all runners are portable.
+ typehint_type = str(typehint_type)
Review Comment:
Actually `str()` might be non-deterministic for a Union type such as
`Optional[Union[str, int]]`. So this could potentially break when it's
stringified differently when register_coder and get_coder. An example flaky
test we encountered in the past: https://github.com/apache/beam/pull/17351.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]