Skip to content

util: add support columnar scan details (#69331) - #69426

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:release-nextgen-202603from
yongman:cherry-pick-69331-to-release-nextgen-202603
Jun 29, 2026
Merged

util: add support columnar scan details (#69331)#69426
ti-chi-bot[bot] merged 2 commits into
pingcap:release-nextgen-202603from
yongman:cherry-pick-69331-to-release-nextgen-202603

Conversation

@yongman

@yongman yongman commented Jun 24, 2026

Copy link
Copy Markdown
Member

This is an cherry-pick of #69331

What problem does this PR solve?

Issue Number: close #69353

Problem Summary:
There is no execution stats summary when the query using columnar instead of tiflash.

What changed and how does it work?

Add columnarScanContext to TiflashStats and collect the stats from tipb::ColumnarScanContext.

TiDB root@localhost:test> explain analyze select * from t;
+----------------------+---------+---------+--------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+----------+------+
| id                   | estRows | actRows | task         | access object | execution info                                                                                                                                                                                                                                                                                                                                                                                                | operator info                             | memory   | disk |
+----------------------+---------+---------+--------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+----------+------+
| TableReader_12       | 8204.00 | 8204    | root         | partition:all | time:63.5ms, loops:10, RU:5.38, cop_task: {num: 2, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00}                                                                                                                                                                                                                                                                                            | MppVersion: 2, data:ExchangeSender_11     | 192.7 KB | N/A  |
| └─ExchangeSender_11  | 8204.00 | 8204    | mpp[tiflash] |               | tiflash_task:{time:52.8ms, loops:1, threads:1}                                                                                                                                                                                                                                                                                                                                                                | ExchangeType: PassThrough                 | N/A      | N/A  |
|   └─TableFullScan_10 | 8204.00 | 8204    | mpp[tiflash] | table:t       | tiflash_task:{time:44.8ms, loops:1, threads:1}, columnar_scan:{mvcc_input_rows:8204, mvcc_input_bytes:360976, mvcc_output_rows:8204, regions:1, read_tasks:1, physical_tables:3, columns:3, user_read_bytes:155876, read_block:8ms, serialize_block:0ms, init_reader:12ms, prefetch:0ms, deserialize_block:4ms, rough_check:{total:0, selected:0, skipped:0, unknown:0}, remote_segments:0, total_segments:4} | keep order:false, PartitionTableScan:true | N/A      | N/A  |
+----------------------+---------+---------+--------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------+----------+------+

3 rows in set
Time: 0.077s

Deps

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

  • New Features

    • TiFlash runtime stats now include richer columnar scan details in performance output.
    • Aggregated scan summaries now show columnar scan metrics when available.
  • Bug Fixes

    • Improved handling of TiFlash stats so merged results and displayed summaries stay consistent across multiple tasks.
  • Chores

    • Updated a pinned dependency version used by the build and dependency configuration.

yongman added 2 commits June 24, 2026 06:03
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Ray Yan <yming0221@gmail.com>
@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 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: 5f50605a-1147-4758-b686-bb6a280d0365

📥 Commits

Reviewing files that changed from the base of the PR and between 06a52ed and 86fa705.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • DEPS.bzl
  • go.mod
  • pkg/util/execdetails/execdetails_test.go
  • pkg/util/execdetails/runtime_stats.go
  • pkg/util/execdetails/tiflash_stats.go

📝 Walkthrough

Walkthrough

Bumps github.com/pingcap/tipb to expose ColumnarScanContext proto fields, then adds a new TiFlashColumnarScanContext type to tiflash_stats.go with Clone, String, Merge, mergeExecSummary, and Empty methods. Integrates the new field into TiflashStats and the existing basicCopRuntimeStats clone/merge/string pipeline in runtime_stats.go.

Changes

TiFlash Columnar Scan Execution Stats

Layer / File(s) Summary
tipb dependency bump
go.mod, DEPS.bzl
Updates github.com/pingcap/tipb to v0.0.0-20260617071407-7c071244534b and re-pins the corresponding sha256 and urls in DEPS.bzl.
TiFlashColumnarScanContext type and methods
pkg/util/execdetails/tiflash_stats.go
Adds columnarScanContext TiFlashColumnarScanContext field to TiflashStats, introduces TiFlashColumnarScanContext struct with all columnar metric fields, and implements Clone, String, Merge, mergeExecSummary, and Empty.
Integration into Clone/Merge/mergeExecSummary/String
pkg/util/execdetails/runtime_stats.go
Propagates columnarScanContext in basicCopRuntimeStats.Clone, Merge, and mergeExecSummary; CopRuntimeStats.String renders columnarScanContext.String() when non-empty, otherwise falls back to scanContext.String().
Columnar scan stats tests
pkg/util/execdetails/execdetails_test.go
Adds mockExecutorExecutionSummaryForTiFlashColumnar helper and TestColumnarScanContextStats verifying aggregated columnar_scan:{...} output for two TiFlash tasks and a zero-value scenario.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • pingcap/tidb#69331: Directly related — implements the same TiflashStats.columnarScanContext clone/merge/string integration and matching execdetails_test.go mock/assertion pattern for columnar scan details.

Suggested labels

size/XL

Suggested reviewers

  • coocood
  • JaySon-Huang
  • 3pointer
  • bb7133

🐇 A new scan context hops into view,
columnar stats now rendered true,
regions, tasks, and rough-check packs—
merging totals, no data lacks!
columnar_scan:{...} shines in explain,
the rabbit cheers this stats refrain! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: adding columnar scan details support.
Description check ✅ Passed The PR description follows the template and includes issue number, summary, changes, tests, side effects, docs, and release note.
Linked Issues check ✅ Passed The code adds columnar scan execution stats and tests, matching the linked issue's explain-analyze summary requirement.
Out of Scope Changes check ✅ Passed The changes align with the columnar scan stats objective and don't show unrelated additions.

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

✨ 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.

@yongman

yongman commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

/retest-required

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.91391% with 56 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release-nextgen-202603@06a52ed). Learn more about missing BASE report.

Additional details and impacted files
@@                     Coverage Diff                     @@
##             release-nextgen-202603     #69426   +/-   ##
===========================================================
  Coverage                          ?   76.2280%           
===========================================================
  Files                             ?       1935           
  Lines                             ?     540251           
  Branches                          ?          0           
===========================================================
  Hits                              ?     411823           
  Misses                            ?     128428           
  Partials                          ?          0           
Flag Coverage Δ
unit 76.2280% <62.9139%> (?)

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

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

@ti-chi-bot

ti-chi-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

@JaySon-Huang: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In 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.

@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 24, 2026
@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 24, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-06-24 08:40:33.891972775 +0000 UTC m=+109717.555198298: ☑️ agreed by 3pointer.
  • 2026-06-24 09:18:33.822585774 +0000 UTC m=+111997.485811287: ☑️ agreed by coocood.

@yongman

yongman commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

/assign @bb7133

@bb7133 bb7133 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot

ti-chi-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3pointer, bb7133, coocood, JaySon-Huang

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:
  • OWNERS [3pointer,bb7133,coocood]

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 the approved label Jun 29, 2026
@yongman

yongman commented Jun 29, 2026

Copy link
Copy Markdown
Member Author

/test pull-unit-test-next-gen

@ti-chi-bot
ti-chi-bot Bot merged commit dd1be2d into pingcap:release-nextgen-202603 Jun 29, 2026
18 checks passed
@yongman
yongman deleted the cherry-pick-69331-to-release-nextgen-202603 branch June 29, 2026 09:54
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. 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.

5 participants