Skip to content

planner: fix TPCDS Q64 regression under the new join algorithm (#69637)#69654

Open
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-69637-to-release-8.5
Open

planner: fix TPCDS Q64 regression under the new join algorithm (#69637)#69654
ti-chi-bot wants to merge 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-69637-to-release-8.5

Conversation

@ti-chi-bot

@ti-chi-bot ti-chi-bot commented Jul 3, 2026

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #69637

What problem does this PR solve?

Issue Number: ref #69600

Problem Summary: planner: fix TPCDS Q64 regression under the new CD-C join algorithm

What changed and how does it work?

In TPCDS Q64, ib1 and ib2 have the same row count, but the old join-order implementation is using SortStableFunc while the new one is using SortFunc, which leads to this join order change.

This PR update the new join-order implementation to also use SortStableFunc to keep the prior behavior.

image image

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

Summary by CodeRabbit

  • Tests
    • Added new TPC-DS test case coverage for a query plan scenario.
    • Included expected plan output to validate query behavior more reliably.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added 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. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Jul 3, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be LGTMed and approved by the reviewers firstly.
  2. For pull requests to TiDB-x branches, it must have no failed tests.
  3. AFTER it has lgtm and approved labels, please wait for the cherry-pick merging approval from triage owners.
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.

@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

[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 ailinkid 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

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3ec99a03-b0f4-4451-810e-a77cb9cfefa2

📥 Commits

Reviewing files that changed from the base of the PR and between a13d3f6 and 41d1add.

📒 Files selected for processing (2)
  • pkg/planner/core/casetest/tpcds/testdata/tpcds_suite_out.json
  • pkg/planner/core/casetest/tpcds/testdata/tpcds_suite_xut.json

📝 Walkthrough

Walkthrough

This PR adds two new JSON test data files defining the TestTPCDSQ64 test case, each containing an explain format='plan_tree' SQL query and its expected physical plan tree output as a Result string array.

Changes

TPC-DS Q64 test suite data

Layer / File(s) Summary
Add TestTPCDSQ64 test case data
pkg/planner/core/casetest/tpcds/testdata/tpcds_suite_out.json, pkg/planner/core/casetest/tpcds/testdata/tpcds_suite_xut.json
New JSON test suite files defining the TestTPCDSQ64 case with the SQL query and expected plan-tree Result output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Suggested reviewers: qw4990, hawkingrei, AilinKid

Poem

A rabbit hops through JSON trees,
Q64's plan laid out with ease,
Cases added, results in line,
TPC-DS tests now shine,
Thump-thump, all tests agree! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing the TPCDS Q64 regression in the planner.
Description check ✅ Passed The description follows the template with issue reference, problem summary, change details, tests, and release note block.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-8.5@a13d3f6). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-8.5     #69654   +/-   ##
================================================
  Coverage               ?   55.1238%           
================================================
  Files                  ?       1849           
  Lines                  ?     666253           
  Branches               ?          0           
================================================
  Hits                   ?     367264           
  Misses                 ?     271613           
  Partials               ?      27376           
Flag Coverage Δ
integration 38.2052% <ø> (?)
unit 65.1691% <ø> (?)

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

Components Coverage Δ
dumpling 55.3108% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 54.8112% <0.0000%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

do-not-merge/cherry-pick-not-approved 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. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants