You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "robertwb (via GitHub)" <gi...@apache.org> on 2023/09/18 18:45:02 UTC
[GitHub] [beam] robertwb commented on a diff in pull request #28289: Better errors when inputs are omitted.
robertwb commented on code in PR #28289:
URL: https://github.com/apache/beam/pull/28289#discussion_r1329144050
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -61,6 +61,16 @@ def provided_transforms(self) -> Iterable[str]:
"""Returns a list of transform type names this provider can handle."""
raise NotImplementedError(type(self))
+ def requires_inputs(self, typ: str, args: Mapping[str, Any]) -> bool:
+ """Returns whether this transform requires inputs.
+
+ Specifically, if this returns True and inputs are not provided than an error
+ will be thrown.
+
+ This is best-effort, primarily for better and earlier error messages.
+ """
+ return not typ.startswith('Read')
Review Comment:
Yep, just a reasonable default. Most transforms that do not start with Read require an input by, the main exception being SQL (where we can't tell and the "typical" use of selecting on PCollection would be good to error on). One can explicitly state `inputs: []` to suppress this error.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org