-
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
Fix invalid projection in CommonSubexprEliminate
#2915
Conversation
@jdye64 Here is the fix for the root cause of the invalid projections in the optimizer |
@waynexia fyi |
Codecov Report
@@ Coverage Diff @@
## master #2915 +/- ##
=======================================
Coverage 85.30% 85.31%
=======================================
Files 274 274
Lines 49267 49279 +12
=======================================
+ Hits 42028 42040 +12
Misses 7239 7239
Continue to review full report at Codecov.
|
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.
Thanks for pinning this down ❤️ This patch looks good to me.
@@ -282,15 +282,13 @@ fn build_project_plan( | |||
} | |||
|
|||
for field in input.schema().fields() { | |||
if !fields_set.contains(field.name()) { | |||
fields_set.insert(field.name().to_owned()); | |||
if fields_set.insert(field.qualified_name()) { |
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
Use qualified name instead of unqualified name in the HashSet that tracks which fields have already been added to the projection
This is correct 👍 It used to be inconsistent with L287 which uses qualified name.
fields.push(field.clone()); | ||
project_exprs.push(Expr::Column(field.qualified_column())); | ||
} | ||
} | ||
|
||
let mut schema = DFSchema::new_with_metadata(fields, HashMap::new())?; | ||
schema.merge(input.schema()); |
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.
merge
is done in the previous for
loop so I think this is redundant. Let's remove it.
Benchmark runs are scheduled for baseline = d8a2f58 and contender = b5537e7. b5537e7 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?
Closes #2907
Rationale for this change
CommonSubexprEliminate
created invalid projections when processing joins where there were one or more columns with the same unqualified name on each side of the join (as happens when you join to the same table multiple times).What changes are included in this PR?
HashSet
that tracks which fields have already been added to the projectionAre there any user-facing changes?
No