Skip to content

planner: migrate EXPLAIN output in integration_test.go to format='plan_tree' - #67435

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:masterfrom
henrybw:migrate-explain-plantree-2
Mar 31, 2026
Merged

ti-chi-bot[bot] merged 2 commits into
pingcap:masterfrom
henrybw:migrate-explain-plantree-2

Conversation

@henrybw

@henrybw henrybw commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #67112

Problem Summary: Test cases that rely on EXPLAIN output in format='brief' or format='verbose', but only need to validate the structure of the plan, are brittle and will start failing if minor changes in row estimates or table schema occur. This requires regenerating a large number of new plans for optimizer tests when making changes, adding noise to PR diffs and obscuring potential problems that these tests may have otherwise caught.

What changed and how does it work?

Convert non-analyze EXPLAIN tests in pkg/planner/core/integration_test.go to use format='plan_tree'. This strips operator ID suffixes, omits estRows, and normalizes "Column#N" to "Column". This also necessitates updating a number of column indices, because estRows is no longer included for example.

EXPLAIN ANALYZE tests still use format='brief' since format='plan_tree' is not supported by EXPLAIN ANALYZE.

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
    • Updated query-plan tests to match a revised plan-tree output format and adjusted expected plan/operator renderings.
    • Alignments made for projected/aggregated/windowed operator output and index offsets in test assertions.
    • No user-facing changes.

…plan_tree'`

Convert non-analyze `EXPLAIN` tests in pkg/planner/core/integration_test.go
to use `format='plan_tree'`. This strips operator ID suffixes, omits
estRows, and normalizes Column#N to Column.

`EXPLAIN ANALYZE` tests still use `format='brief'` since `format='plan_tree'`
is not supported by `EXPLAIN ANALYZE`.
@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 30, 2026
@pantheon-ai

pantheon-ai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Review failed due to infrastructure/execution failure after retries. Please re-trigger review.

ℹ️ Learn more details on Pantheon AI.

@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. sig/planner SIG: Planner labels Mar 30, 2026
@tiprow

tiprow Bot commented Mar 30, 2026

Copy link
Copy Markdown

Hi @henrybw. 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.

@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

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: cc183895-9ec5-4245-9ef8-cb0ee482fcc4

📥 Commits

Reviewing files that changed from the base of the PR and between fe7e83c and 3480e23.

📒 Files selected for processing (1)
  • pkg/planner/core/integration_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/planner/core/integration_test.go

📝 Walkthrough

Walkthrough

Switched multiple planner integration tests in pkg/planner/core/integration_test.go from EXPLAIN FORMAT='brief' to EXPLAIN FORMAT='plan_tree', updating expected plan-tree strings, projection/aggregation/window operator renderings, and adjusted row/column index checks in test assertions.

Changes

Cohort / File(s) Summary
Integration test assertions
pkg/planner/core/integration_test.go
Replaced EXPLAIN format 'brief' with 'plan_tree' in tests. Updated expected plan-tree outputs by removing numeric cost/row-estimate fields and Column#N suffixes, adjusted Rows() index positions and CheckAt index sets, and revised operator/projection/aggregation/window formatting expectations. Also removed TableReader cost assertion in an isolation-read test for mysql.stats_meta while keeping TiKV cop subtree checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

size/L, ok-to-test

Suggested reviewers

  • AilinKid
  • qw4990
  • hawkingrei

Poem

🐰 I hopped through tests with nimble feet,

Swapped brief for plan_tree — a tidy feat,
Indices shifted, columns pruned away,
Trees now stand where numbers used to sway,
A joyful hop for tests today! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: migrating EXPLAIN output format from brief/verbose to plan_tree in integration tests.
Description check ✅ Passed The description addresses the template requirements: includes issue reference, explains the problem, describes what changed, covers testing status, and provides release notes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

Command failed


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 and usage tips.

@codecov

codecov Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.5546%. Comparing base (1fef0d9) to head (3480e23).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #67435        +/-   ##
================================================
- Coverage   77.8038%   77.5546%   -0.2492%     
================================================
  Files          2023       1943        -80     
  Lines        556529     543320     -13209     
================================================
- Hits         433001     421370     -11631     
- Misses       121782     121948       +166     
+ Partials       1746          2      -1744     
Flag Coverage Δ
integration 40.9703% <ø> (-7.1558%) ⬇️
unit 76.7366% <ø> (+0.3685%) ⬆️

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

Components Coverage Δ
dumpling 61.5065% <ø> (ø)
parser ∅ <ø> (∅)
br 48.8762% <ø> (-11.9832%) ⬇️
🚀 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 approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 30, 2026
@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 31, 2026
@ti-chi-bot

ti-chi-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-03-30 20:44:08.887325769 +0000 UTC m=+211454.092685816: ☑️ agreed by terry1purcell.
  • 2026-03-31 01:04:16.103927851 +0000 UTC m=+227061.309287918: ☑️ agreed by hawkingrei.

@ti-chi-bot

ti-chi-bot Bot commented Mar 31, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, qw4990, terry1purcell

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

The pull request process is described 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 merged commit b2c827c into pingcap:master Mar 31, 2026
35 checks passed
@henrybw
henrybw deleted the migrate-explain-plantree-2 branch March 31, 2026 02:29
bitloi pushed a commit to bitloi/tidb that referenced this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm 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