-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor: parquet pruning simplifications #5386
Conversation
I am pretty sure that this test breakage is unrelated, seems flaky to me:
|
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.
Nice simplification, LGTM 👍
/// Returns number of unique columns. | ||
pub(crate) fn n_columns(&self) -> usize { | ||
self.iter() | ||
.map(|(c, _s, _f)| c) |
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.
More descriptive variable names would help readability here.
.unwrap_or(unhandled); | ||
return Ok(expr); |
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.
Oh, so this was always returning Ok?
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.
Yes
match PruningPredicate::try_new(predicate.clone(), schema.clone()) { | ||
Ok(p) | ||
if (!p.allways_true()) | ||
&& (p.required_columns().n_columns() < 2) => |
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 a behavior change for n_columns() == 0
. Based on:
pub fn allways_true(&self) -> bool {
self.predicate_expr
.as_any()
.downcast_ref::<Literal>()
.map(|l| matches!(l.value(), ScalarValue::Boolean(Some(true))))
.unwrap_or_default()
}
I ran the test suite, panicing if n_columns() == 0
and I can't get it to happen, so I guess it LGTM.
I assume that would default to false, in which case I think we'd want to return a None
here?
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, we skip the predicate if we don't refer to any column. However you might be right (at least this is how I read your comment) that we need additional test coverage for a "constant" predicate (i.e. one that doesn't reference any column). I'll check next week if such a test exists and if not, add one.
Benchmark runs are scheduled for baseline = 7224901 and contender = 1841736. 1841736 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Prep work for #4695.
Rationale for this change
Makes the actual change in #4695 easier.
What changes are included in this PR?
Internal improvements.
Are these changes tested?
Existing tests pass, no function changes.
Are there any user-facing changes?
-