-
Notifications
You must be signed in to change notification settings - Fork 6.1k
planner: allow LEADING hint to match plan nodes with anonymous columns #65837
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
base: master
Are you sure you want to change the base?
Conversation
|
Hi @ghoshh. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
Hi @ghoshh. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions 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. |
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.
Pull request overview
Updates planner hint matching so LEADING can match plan nodes whose OutputNames() include anonymous/empty table-name columns (e.g., types.EmptyName), by ignoring those columns when extracting the table alias.
Changes:
- Adjust
ExtractTableAliasto find the first non-empty table name and ignore columns with emptyTblNameduring alias consistency checks. - Preserve existing query-block offset adjustment logic while allowing alias extraction to succeed for plans with anonymous output columns.
| blockAsNames = *p | ||
| } | ||
| // For sub-queries like `(select * from t) t1`, t1 should belong to its surrounding select block. | ||
| if qbOffset != parentOffset && blockAsNames != nil && blockAsNames[qbOffset].TableName.L != "" { |
Copilot
AI
Jan 27, 2026
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.
blockAsNames[qbOffset] can panic when qbOffset is negative (e.g. -1) or >= len(blockAsNames). This path is now reachable even when the first output name has an empty table name (because we scan for the first non-empty TblName), so it can introduce new panics compared to the previous early-return behavior. Add an explicit bounds check (and ensure qbOffset >= 0) before indexing blockAsNames.
| if qbOffset != parentOffset && blockAsNames != nil && blockAsNames[qbOffset].TableName.L != "" { | |
| if qbOffset != parentOffset && | |
| blockAsNames != nil && | |
| qbOffset >= 0 && | |
| qbOffset < len(blockAsNames) && | |
| blockAsNames[qbOffset].TableName.L != "" { |
|
/ok-to-test |
fixdb
left a comment
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.
Can we add test cases?
|
I’ve added several new tests. The LEADING hint now takes effect, but it still emits a warning. The warning is generated during the plan-building phase (not join reordering), I think we can fix it in the future. |
Codecov Report✅ All modified and coverable lines are covered by tests. Please upload reports for the commit d99bca4 to get more accurate results. Additional details and impacted files@@ Coverage Diff @@
## master #65837 +/- ##
================================================
- Coverage 77.7956% 77.3594% -0.4362%
================================================
Files 2000 1921 -79
Lines 545038 535107 -9931
================================================
- Hits 424016 413956 -10060
- Misses 119360 120889 +1529
+ Partials 1662 262 -1400
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
|
[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 |
|
@ghoshh: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
|
@ghoshh: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: ref #65797
Problem Summary:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.