Skip to content

Conversation

@ghoshh
Copy link
Contributor

@ghoshh ghoshh commented Jan 27, 2026

What problem does this PR solve?

Issue Number: ref #65797

Problem Summary:

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Copilot AI review requested due to automatic review settings January 27, 2026 07:35
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. contribution This PR is from a community contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/planner SIG: Planner labels Jan 27, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 27, 2026

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@tiprow
Copy link

tiprow bot commented Jan 27, 2026

Hi @ghoshh. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

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.

Copy link

Copilot AI left a 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 ExtractTableAlias to find the first non-empty table name and ignore columns with empty TblName during 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 != "" {
Copy link

Copilot AI Jan 27, 2026

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.

Suggested change
if qbOffset != parentOffset && blockAsNames != nil && blockAsNames[qbOffset].TableName.L != "" {
if qbOffset != parentOffset &&
blockAsNames != nil &&
qbOffset >= 0 &&
qbOffset < len(blockAsNames) &&
blockAsNames[qbOffset].TableName.L != "" {

Copilot uses AI. Check for mistakes.
@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 27, 2026
Copy link
Contributor

@fixdb fixdb left a 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?

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 28, 2026
@ghoshh
Copy link
Contributor Author

ghoshh commented Jan 28, 2026

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.
I'll try to add more test cases.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.3594%. Comparing base (5da5f2a) to head (c8de6a1).
⚠️ Report is 25 commits behind head on master.

⚠️ Current head c8de6a1 differs from pull request most recent head d99bca4

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     
Flag Coverage Δ
integration 41.4931% <100.0000%> (-6.6775%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 56.7974% <ø> (ø)
parser ∅ <ø> (∅)
br 48.8044% <ø> (-12.1671%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 29, 2026
@Reminiscent
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot bot added component/statistics size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 29, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign king-dylan for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 29, 2026
@tiprow
Copy link

tiprow bot commented Jan 29, 2026

@ghoshh: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow d99bca4 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 29, 2026

@ghoshh: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-br-integration-test a4ccddb link true /test pull-br-integration-test
pull-lightning-integration-test a4ccddb link true /test pull-lightning-integration-test
pull-unit-test-ddlv1 a4ccddb link true /test pull-unit-test-ddlv1
idc-jenkins-ci-tidb/check_dev d99bca4 link true /test check-dev
idc-jenkins-ci-tidb/check_dev_2 d99bca4 link true /test check-dev2
pull-unit-test-next-gen d99bca4 link true /test pull-unit-test-next-gen
idc-jenkins-ci-tidb/unit-test d99bca4 link true /test unit-test

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/statistics contribution This PR is from a community contributor. ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants