Polber commented on code in PR #30055:
URL: https://github.com/apache/beam/pull/30055#discussion_r1462260802
##########
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:
Does there need to be a new provider? Seems as though `RenamingProvider` has
all the relevant functionality and would allow mappings and defaults should
there be Java built-in transforms that expose those in the future
--
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]