-
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
Remove qualifiers on pushed down predicates / Fix parquet pruning #689
Conversation
eb980a5
to
432ce23
Compare
// Remove all qualifiers from the scan as the provider | ||
// doesn't know (nor should care) how the relation was | ||
// referred to in the query | ||
let filters = unnormalize_cols(filters.iter().cloned()); |
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.
Here is the actual fix for parquet pruning.
@@ -1762,4 +1794,76 @@ mod tests { | |||
} | |||
} | |||
} | |||
|
|||
#[test] | |||
fn normalize_cols() { |
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 added some additional unit test coverage here for normalize when I was writing the unnormalize
versions
datafusion/src/logical_plan/expr.rs
Outdated
@@ -1120,7 +1120,7 @@ pub fn columnize_expr(e: Expr, input_schema: &DFSchema) -> Expr { | |||
|
|||
/// Recursively call [`Column::normalize`] on all Column expressions | |||
/// in the `expr` expression tree. | |||
pub fn normalize_col(e: Expr, schemas: &[&DFSchemaRef]) -> Result<Expr> { | |||
pub fn normalize_col(expr: Expr, schemas: &[&DFSchemaRef]) -> Result<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.
Changed to use the name expr
to be more consistent with the rest of the codebase
FYI @houqp |
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!
20f7472
to
de6de17
Compare
de6de17
to
c2971f9
Compare
Which issue does this PR close?
Closes ##656
Based on #657 (test for parquet pruning) so review that first
Rationale for this change
Predicate pushdown for parquet is currently broken because the filtering logic gets columns that refer to
foo.bar
but the table provider only knows about columns (e.g. only aboutbar)
What changes are included in this PR?
unnormalize_expr
function to remove qualifiers from expressionsAre there any user-facing changes?
Pruning works again