-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Minor: make Expr::volatile infallible
#13206
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
Conversation
peter-toth
left a comment
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.
LGTM, this looks like the same idea as #13128 (comment)
eejbyfeldt
left a comment
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.
LGTM!
| /// | ||
| /// See [`Volatility`] for more information. | ||
| pub fn is_volatile(&self) -> bool { | ||
| self.exists(|expr| Ok(expr.is_volatile_node())).unwrap() |
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.
Add code comment why unwrap is safe here.
btw maybe we can have exists variant which doesn't throw?
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.
I will add the comment in a follow on PR The non fallable exists variant is an interesting idea -- maybe we can file a follow on issue for it
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.
Follow on PR: #13217
|
Thanks @findepi @peter-toth @jonahgao and @eejbyfeldt for the review -- I am going to merge this PR as it logically conflicts with #13128 so I can rebase that PR |
Which issue does this PR close?
Related to
Rationale for this change
While reviewing #13128 I noticed that the code got a bit more complicated because
Expr::volatilereturnsResult<bool>and thus the calling code needs now to pass upResultsHowever,
Expr::volatileis actually infallible (never returns an error) so let's mark it as such to keep the code simplerThis is also consistent with other
Exprmethods such asExpr::any_column_refsWhat changes are included in this PR?
Expr::volatileinfallibleAre these changes tested?
By existing CI
Are there any user-facing changes?
Expr::volatilehas changed