fix: Correct ANY/ALL results for unaliased subqueries on the same table - #25273
fix: Correct ANY/ALL results for unaliased subqueries on the same table#25273AdamGS wants to merge 2 commits into
Conversation
|
I also suspect the mark join shape here is suboptimal, I'll follow up on that with a proper issue and hopefully a PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25273 +/- ##
==========================================
- Coverage 81.91% 81.91% -0.01%
==========================================
Files 1134 1134
Lines 425637 425745 +108
Branches 425637 425745 +108
==========================================
+ Hits 348654 348740 +86
- Misses 56302 56326 +24
+ Partials 20681 20679 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
| /// # Return value | ||
| /// | ||
| /// Tuple of (expressions containing joins, remaining non-join expressions) | ||
| #[deprecated( |
There was a problem hiding this comment.
This function strips outer references which I think is somewhat unexpected, and was the root cause of this bug.
Its not called anymore, so deprecating it seems like a nice improvement, reducing the overall API surface.
Signed-off-by: Adam Gutglick <adamgsal@gmail.com>
3254115 to
471e01a
Compare
Which issue does this PR close?
Rationale for this change
During the various decorrelation passes, stripping outer references too early makes the outer and inner columns indistinguishable. Both operands are then rewritten to reference the subquery, turning the join predicate into a comparison of an inner column with itself (something like col1 > col1).
What changes are included in this PR?
Its mostly a minor change in where we strip the outer column reference from the join filter in the optimizer.
What is the testing strategy for this PR?
New SLT tests provided in the initial issue, asserting both results and logical plan shape.
Are there any user-facing changes?
Depreciating the
find_join_exprswhich isn't called internally anymore, replacing it with a helper function indecorrelate.rs.