robertwb commented on code in PR #30055:
URL: https://github.com/apache/beam/pull/30055#discussion_r1462284414
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -755,6 +756,81 @@ def create_builtin_provider():
no_input_transforms=('Create', ))
+class TranslatingProvider(Provider):
+ def __init__(
+ self,
+ transforms: Mapping[str, Callable[..., beam.PTransform]],
+ underlying_provider: Provider):
+ self._transforms = transforms
+ self._underlying_provider = underlying_provider
+
+ def provided_transforms(self):
+ return self._transforms.keys()
+
+ def available(self):
+ return self._underlying_provider.available()
+
+ def cache_artifacts(self):
+ return self._underlying_provider.cache_artifacts()
+
+ def underlying_provider(self):
+ return self._underlying_provider
+
+ def to_json(self):
+ return {'type': "TranslatingProvider"}
+
+ def create_transform(
+ self, typ: str, config: Mapping[str, Any],
+ yaml_create_transform: Any) -> beam.PTransform:
+ return self._transforms[typ](self._underlying_provider, **config)
Review Comment:
This does a deeper rewriting of the arguments than renaming, though I was
thinking that the renaming transform could be defined as a special case of this
one. (The SQL-based one possibly as well.)
--
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]