-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Eagerly construct PagePruningPredicate #4713
Eagerly construct PagePruningPredicate #4713
Conversation
} | ||
|
||
let groups = file_metadata.row_groups(); | ||
/// Returns a [`RowSelection`] for the given file | ||
pub fn prune( |
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 recommend viewing this with whitespace disabled
https://github.com/apache/arrow-datafusion/pull/4713/files?diff=split&w=1
@@ -203,35 +220,6 @@ fn combine_multi_col_selection(row_selections: Vec<Vec<RowSelector>>) -> RowSele | |||
.unwrap() | |||
} | |||
|
|||
// Extract single col pruningPredicate from input predicate for evaluating page Index. | |||
fn extract_page_index_push_down_predicates( |
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 reworked into PagePruningPredicate::try_new
.filter_map(|predicate| match predicate.to_columns() { | ||
Ok(columns) if columns.len() == 1 => { | ||
match PruningPredicate::try_new(predicate.clone(), schema.clone()) { | ||
Ok(p) if !p.allways_true() => Some(Ok(p)), |
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.
It is important we filter these out as they cause issues for the pruning logic below as they no longer refer to a single column. Previously this was being as a side-effect of the filtering when constructing the row group pruning predicate
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.
Why don't they refer to a single column? isn't this branch protected by a match guard if columns.len() == 1
?
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.
Because the expression gets simplified down to true
and therefore now refers to no columns 😅
I suspect there may be a bug here, but this at least preserves the existing behaviour
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.
Looks good to me -- thanks @tustvold
match PagePruningPredicate::try_new(predicate_expr, file_schema.clone()) { | ||
Ok(pruning_predicate) => Some(Arc::new(pruning_predicate)), | ||
Err(e) => { | ||
debug!("Could not create page pruning predicate for: {}", e); |
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 think it would be worth including the predicate_expr
in this message too
debug!("Could not create page pruning predicate for: {}", e); | |
debug!("Could not create page pruning predicate for '{}': {}", predicate_expr, e); |
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.
Proposed change in #4736
.filter_map(|predicate| match predicate.to_columns() { | ||
Ok(columns) if columns.len() == 1 => { | ||
match PruningPredicate::try_new(predicate.clone(), schema.clone()) { | ||
Ok(p) if !p.allways_true() => Some(Ok(p)), |
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.
Why don't they refer to a single column? isn't this branch protected by a match guard if columns.len() == 1
?
Benchmark runs are scheduled for baseline = 2f5b25d and contender = fe3f018. fe3f018 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?
Part of #4693
Rationale for this change
Eagerly constructing the
PagePruningPredicate
not only saves cycles, but allows it to occur whenExecutionProps
is in scope. A future PR will updatePruningPredicate
to require this to resolve #4693What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?