-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(firestore): support let stage #16030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -303,6 +303,24 @@ def _pb_options(self) -> dict[str, Value]: | |||||
| return options | ||||||
|
|
||||||
|
|
||||||
| class Let(Stage): | ||||||
| """Defines variables for use in subsequent stages.""" | ||||||
|
|
||||||
| def __init__(self, **variables: Expression): | ||||||
| super().__init__("let") | ||||||
| self.variables = variables | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To ensure deterministic output for
Suggested change
References
|
||||||
|
|
||||||
| def _pb_args(self): | ||||||
| map_val = { | ||||||
| k: v._to_pb() for k, v in self.variables.items() | ||||||
| } | ||||||
| return [Value(map_value={"fields": map_val})] | ||||||
|
|
||||||
| def __repr__(self): | ||||||
| vars_str = ", ".join(f"{k}={v!r}" for k, v in self.variables.items()) | ||||||
| return f"{self.__class__.__name__}({vars_str})" | ||||||
|
|
||||||
|
|
||||||
| class RawStage(Stage): | ||||||
| """Represents a generic, named stage with parameters.""" | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring mentions
Variable.of("rating_plus_one"), but theVariableclass or a way to reference variables doesn't seem to be part of this pull request, as indicated by the TODO itemadd variable_field_reference. To avoid confusion and documenting a feature that is not yet available, it would be better to remove this line. The preceding sentences already explain that variables can be used in subsequent stages.