-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Minor: Simplify conjunction and disjunction, improve docs #10446
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@@ -1107,20 +1107,49 @@ fn split_binary_impl<'a>( | |||
/// assert_eq!(conjunction(split), Some(expr)); | |||
/// ``` | |||
pub fn conjunction(filters: impl IntoIterator<Item = Expr>) -> Option<Expr> { | |||
filters.into_iter().reduce(|accum, expr| accum.and(expr)) | |||
filters.into_iter().reduce(Expr::and) |
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.
this is the very minor simplification and while I was in here I figured I would improve the docs too
c873b4f
to
9bc4fbf
Compare
pub fn disjunction(filters: impl IntoIterator<Item = Expr>) -> Option<Expr> { | ||
filters.into_iter().reduce(|accum, expr| accum.or(expr)) | ||
filters.into_iter().reduce(Expr::or) |
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.
Wow, surprise that this works
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.
Yeah, that was my first reaction when I saw this in Filter pushdown and it took me a while to figure out what was actually doing 🤯
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.
👍
Which issue does this PR close?
N/A
Rationale for this change
I ran into this code while working on #10291
What changes are included in this PR?
conjunction
anddisjunction
Are these changes tested?
New doc test and existing CI
Are there any user-facing changes?