planner: skip plan cache for join ON subqueries - #68422
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR fixes inconsistent behavior between normal and prepared SELECT statements when subqueries appear in JOIN ON conditions. The fix detects such subqueries and disables plan cache to prevent execution errors in prepared statements, with comprehensive test validation. ChangesPlan cache disabling for JOIN ON subqueries
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #68422 +/- ##
================================================
- Coverage 77.2764% 76.5019% -0.7746%
================================================
Files 2010 1992 -18
Lines 555481 557543 +2062
================================================
- Hits 429256 426531 -2725
- Misses 125305 130969 +5664
+ Partials 920 43 -877
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/test mysql-test |
|
@hawkingrei: The specified target(s) for Use DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
What problem does this PR solve?
Issue Number: close #65975
Problem Summary:
Prepared statements could fail with
ON condition doesn't support subqueries yetwhen the query used an uncorrelated scalar subquery in aJOIN ... ONcondition. The equivalent normalSELECTsucceeds because the subquery can be evaluated during plan build, but the prepared plan-cache path kept?markers as mutable constants long enough for the ON rewriter to build an unsupportedApply.What changed and how does it work?
When planning a join
ONexpression that contains subqueries, skip plan cache before rewriting the ON expression. This keeps preparedEXECUTEparameters as concrete constants for the current execution, so the existing build-time subquery evaluation path can handle the uncorrelated subquery instead of producing an unsupportedApply.A regression test covers the normal query and the prepared
EXECUTEform from the issue, and checks that the prepared path skips plan cache.Check List
Tests
Side effects
Documentation
Manual test
Compared with MySQL 9.4.0 in a local temporary container. Both normal and prepared forms return one
NULLrow; MySQL reports a1292 Truncated incorrect INTEGER value: ''warning for the prepared form.Tests
Release note
Summary by CodeRabbit