-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: Fix incorrect predicate pushdown for predicates referring to right-join key columns #21293
fix: Fix incorrect predicate pushdown for predicates referring to right-join key columns #21293
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21293 +/- ##
==========================================
+ Coverage 79.82% 79.89% +0.06%
==========================================
Files 1596 1596
Lines 228565 228574 +9
Branches 2608 2608
==========================================
+ Hits 182462 182622 +160
+ Misses 45507 45356 -151
Partials 596 596 ☔ View full report in Codecov by Sentry. |
use crate::plans::visitor::{AexprNode, RewriteRecursion, RewritingVisitor, TreeWalker}; | ||
use crate::plans::{ExprIR, MintermIter, OutputName}; | ||
|
||
fn remove_suffix<'a>( |
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.
Code moved to join_utils below for re-use
ExprOrigin::None, | ||
|acc_origin, column_name| { | ||
Ok(acc_origin | ||
| Self::get_column_origin(&column_name, left_schema, right_schema, suffix)?) |
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.
Simplified to use BitOr
Non-suffixed columns were incorrectly identified as belonging to the RHS table due to using
check_input_node(predicate.node(), &schema_right, expr_arena)
(which incorrectly matches to the non-suffixed column on the RHS before join). We now useExprOrigin
to correctly identify this.This PR also improves predicate pushdown for predicates referring only to RHS columns in right-joins:
Before
After