Skip to content

Add multi-stage late materialization - #10999

Merged
ti-chi-bot[bot] merged 15 commits into
pingcap:feature/release-8.5-materialized-viewfrom
windtalker:feature/multi-stage-late-materialization
Jul 28, 2026
Merged

Add multi-stage late materialization#10999
ti-chi-bot[bot] merged 15 commits into
pingcap:feature/release-8.5-materialized-viewfrom
windtalker:feature/multi-stage-late-materialization

Conversation

@windtalker

@windtalker windtalker commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #11003

Problem Summary:

For wide DeltaMerge table scans, the existing late materialization path can still read many output columns for rows that are later removed by residual Selection filters. This is inefficient when the residual filter only depends on a small subset of columns and has good selectivity.

What is changed and how it works?

Add multi-stage late materialization for DeltaMerge TableScan

This PR adds multi-stage late materialization for DeltaMerge TableScan when both pushed-down TableScan filters and residual Selection filters exist. The read path is split into:

  • Stage 0: read pushed-filter columns and apply the pushed-down filter.
  • Stage 1: read only residual-filter columns for rows that pass Stage 0, then evaluate the residual filter.
  • Final stage: read the remaining output columns only for rows that pass previous stages.

The implementation is guarded by dt_enable_multi_stage_late_materialization and disables the optimization for unsupported or unsafe cases such as generated columns, keep-order scan, fast scan, force_push_down_all_filters_to_scan, and stage1 filters referencing virtual _tidb_tid. It also keeps TableScan / Selection actRows correct for local, remote-only, and mixed local/remote execution by reporting rows through MSLM runtime stats and delayed remote profile aggregation.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Unit tests run:

  • git diff --check
  • ninja -C /Users/feixu/dev/pingcap/tiflash/cmake-build-debug dbms/gtests_dbms
  • /Users/feixu/dev/pingcap/tiflash/cmake-build-debug/dbms/gtests_dbms --gtest_filter='ExecutorsWithDMTestRunner.MultiStageLateMaterialization*'
  • /Users/feixu/dev/pingcap/tiflash/cmake-build-debug/dbms/gtests_dbms --gtest_filter='SkippableBlockInputStreamTest.MultiStageLateMaterialization*'

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

Add multi-stage late materialization for DeltaMerge TableScan to reduce unnecessary column reads when residual filters are selective.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds conditional multi-stage late materialization for DeltaMerge reads, including residual-filter evaluation, adaptive Late/Direct modes, runtime row statistics, executor row overrides, read-path propagation, tests, and design documentation.

Changes

Multi-stage late materialization

Layer / File(s) Summary
Feature contracts and runtime observability
dbms/src/Flash/Coprocessor/*, dbms/src/Flash/Statistics/ExecutorStatistics.h, dbms/src/Interpreters/Settings.h, dbms/src/Storages/SelectQueryInfo.*, dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h, dbms/src/Flash/Coprocessor/DAGStorageInterpreter.*
Adds feature settings, query metadata, executor row overrides, runtime counters, eligibility checks, and profiling integration.
Adaptive materialization stream
dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.*
Adds staged reads, filter composition, residual evaluation, adaptive Late/Direct selection, block assembly, and summary logging.
DeltaMerge read-path wiring
dbms/src/Storages/DeltaMerge/*, dbms/src/Operators/*, dbms/src/Storages/StorageDeltaMerge.cpp, dbms/src/Storages/StorageDisaggregatedRemote.cpp, dbms/src/Debug/MockStorage.*, dbms/src/Flash/Planner/Plans/PhysicalMockTableScan.*
Propagates late-materialization filters and runtime statistics through read options, tasks, input streams, segment construction, and mock execution paths.
Compatibility validation and design documentation
dbms/src/Storages/DeltaMerge/tests/*, dbms/src/Flash/tests/gtest_executors_with_dm.cpp, docs/design/2026-07-25-multi-stage-late-materialization.md
Updates affected call sites, adds filtering and adaptive-mode coverage, and documents the design and validation plan.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DAGStorageInterpreter
  participant StorageDeltaMerge
  participant SegmentReadTaskPool
  participant Segment
  participant MultiStageLateMaterializationBlockInputStream
  DAGStorageInterpreter->>StorageDeltaMerge: create filter and runtime stats
  StorageDeltaMerge->>SegmentReadTaskPool: pass DMReadOptions
  SegmentReadTaskPool->>Segment: initialize staged input stream
  Segment->>MultiStageLateMaterializationBlockInputStream: provide stage0, stage1, and final-rest streams
  MultiStageLateMaterializationBlockInputStream->>MultiStageLateMaterializationBlockInputStream: evaluate residual filter and materialize output
Loading

Poem

A rabbit hops through stages bright,
Filtering rows by moonlit light.
Late or direct, the blocks align,
Atomic counters softly shine.
Three streams weave a careful dance—
Tests applaud the new advance!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.52% 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
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.
Title check ✅ Passed The title clearly and concisely describes the main change: adding multi-stage late materialization.
Description check ✅ Passed The description matches the template closely, covering the problem, implementation, tests, side effects, and release note.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (6)
dbms/src/Interpreters/Settings.h (1)

229-229: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider defaulting new heuristic-gated feature to false.

dt_enable_multi_stage_late_materialization defaults to true, enabling a non-trivial read-path behavior change (skipping Selection execution and relying on storage to apply the residual filter — see the cross-file comment on DAGStorageInterpreter.cpp) for all queries matching the heuristic, without an opt-in period. Comparable recent flags in this file (e.g. dt_enable_relevant_place) default to false.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dbms/src/Interpreters/Settings.h` at line 229, Change the default value of
the SettingBool entry dt_enable_multi_stage_late_materialization in Settings.h
from true to false, keeping its description and setting name unchanged.
dbms/src/Storages/DeltaMerge/Segment.cpp (1)

3735-3742: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Per-segment LOG_INFO on multi-stage LM adoption may be noisy at scale.

This fires once per segment whenever the multi-stage path is taken, which for a wide scan touching many segments could generate a large volume of INFO-level logs by default (the feature defaults to enabled). Consider LOG_DEBUG here, consistent with other per-segment stream-construction logs in this file (e.g. getReadInfo's "Begin segment create input stream" uses LOG_TRACE/LOG_DEBUG).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dbms/src/Storages/DeltaMerge/Segment.cpp` around lines 3735 - 3742, Change
the multi-stage late-materialization adoption log in the segment
stream-construction path to LOG_DEBUG instead of LOG_INFO, keeping the existing
message and arguments unchanged.
dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h (1)

17-17: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use the project-relative types header.

Replace <common/types.h> with <Core/Types.h> to follow the header include convention.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h` at
line 17, Update the include in MultiStageLateMaterializationRuntimeStats.h to
use the project-relative Core/Types.h header instead of common/types.h,
preserving the existing type dependencies.

Source: Coding guidelines

dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.h (1)

76-82: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use std::string_view for stream names.

These parameters are read-only labels. Update the declarations and matching .cpp definitions to take std::string_view instead of const char *.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.h`
around lines 76 - 82, Update readWithOptionalFilter and skipNextBlockOrRead in
MultiStageLateMaterializationBlockInputStream to accept stream_name as
std::string_view instead of const char *, and apply the same signature change to
their matching .cpp definitions and compatible call sites.

Source: Coding guidelines

dbms/src/Storages/SelectQueryInfo.h (1)

63-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Use camelCase consistently for the new feature API.

Rename the introduced snake_case members and parameters throughout the propagation chain.

  • dbms/src/Storages/SelectQueryInfo.h#L63-L64: rename query feature fields to camelCase.
  • dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h#L27-L28: rename runtime counters to camelCase.
  • dbms/src/Flash/Coprocessor/DAGStorageInterpreter.h#L171-L171: rename interpreter state to camelCase.
  • dbms/src/Storages/DeltaMerge/DeltaMergeStore.h#L208-L209: rename read-option fields to camelCase.
  • dbms/src/Storages/DeltaMerge/Segment.h#L232-L233: rename propagated parameters, including the corresponding declarations at Lines 795-796 and Lines 808-809.
  • dbms/src/Operators/DMSegmentThreadSourceOp.h#L41-L42: rename constructor parameters and backing members, then update dbms/src/Operators/DMSegmentThreadSourceOp.cpp.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dbms/src/Storages/SelectQueryInfo.h` around lines 63 - 64, Rename the new
multi-stage late-materialization API identifiers from snake_case to camelCase
throughout the propagation chain: update fields in
dbms/src/Storages/SelectQueryInfo.h lines 63-64, counters in
dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h lines
27-28, interpreter state in dbms/src/Flash/Coprocessor/DAGStorageInterpreter.h
line 171, read options in dbms/src/Storages/DeltaMerge/DeltaMergeStore.h lines
208-209, and propagated parameters plus declarations in
dbms/src/Storages/DeltaMerge/Segment.h lines 232-233, 795-796, and 808-809.
Rename constructor parameters and backing members in
dbms/src/Operators/DMSegmentThreadSourceOp.h lines 41-42 and update all
corresponding uses in dbms/src/Operators/DMSegmentThreadSourceOp.cpp.

Source: Coding guidelines

dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.cpp (1)

57-82: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Member-initializer-list dereferences residual_filter_ before the null check can run.

residual_filter_action(...)'s arguments include buildResidualFilterHeader(residual_filter_) (which internally does RUNTIME_CHECK(residual_filter != nullptr)) alongside direct dereferences residual_filter_->before_where and residual_filter_->filter_column_name. Argument evaluation order within this single call is unspecified/indeterminately-sequenced, so the direct dereferences could execute before the internal check inside buildResidualFilterHeader, and the constructor body's own RUNTIME_CHECK(residual_filter != nullptr) (L79) only runs after all member initializers have already completed. If a caller ever passed a null residual_filter_ (contrary to today's guaranteed-non-null call sites), this would be a null-pointer dereference rather than a clean RUNTIME_CHECK failure.

In practice all current call sites (e.g. buildMultiStageLateMaterializationFilter in StorageDeltaMerge.cpp) already guarantee non-null before construction, so this is narrow, but worth hardening given it's an easy, cheap fix (e.g., validate via a comma-operator-sequenced helper, or a static factory that checks first and returns validated fields).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.cpp`
around lines 57 - 82, Validate residual_filter_ before any member-initializer
dereference in MultiStageLateMaterializationBlockInputStream. Move or
restructure the residual_filter_action initialization so null validation is
sequenced before accessing before_where or filter_column_name, while preserving
the existing RUNTIME_CHECK behavior and initialization for valid filters.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dbms/src/Flash/Coprocessor/DAGContext.cpp`:
- Around line 298-307: Protect both accesses in
DAGContext::getExecutorRowsOverride with operator_profile_infos_map_mu, using a
const-compatible lock guard and making the mutex mutable if required. Keep the
existing empty/missing-key null returns and returned override behavior
unchanged.

In `@dbms/src/Storages/DeltaMerge/Remote/RNWorkerPrepareStreams.h`:
- Around line 46-47: The RNWorkers path assembled by packSegmentReadTasks must
not select multi-stage late materialization while passing null multi-stage
inputs. Disable multi-stage late materialization for dt_enable_read_thread=false
paths that produce RNWorkers, or propagate the filter and runtime stats through
RNWorkerPrepareStreams::doWork into SegmentReadTask::initInputStream; ensure
executor row overrides registered by DAGStorageInterpreter are preserved.

---

Nitpick comments:
In `@dbms/src/Interpreters/Settings.h`:
- Line 229: Change the default value of the SettingBool entry
dt_enable_multi_stage_late_materialization in Settings.h from true to false,
keeping its description and setting name unchanged.

In
`@dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.cpp`:
- Around line 57-82: Validate residual_filter_ before any member-initializer
dereference in MultiStageLateMaterializationBlockInputStream. Move or
restructure the residual_filter_action initialization so null validation is
sequenced before accessing before_where or filter_column_name, while preserving
the existing RUNTIME_CHECK behavior and initialization for valid filters.

In
`@dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.h`:
- Around line 76-82: Update readWithOptionalFilter and skipNextBlockOrRead in
MultiStageLateMaterializationBlockInputStream to accept stream_name as
std::string_view instead of const char *, and apply the same signature change to
their matching .cpp definitions and compatible call sites.

In `@dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h`:
- Line 17: Update the include in MultiStageLateMaterializationRuntimeStats.h to
use the project-relative Core/Types.h header instead of common/types.h,
preserving the existing type dependencies.

In `@dbms/src/Storages/DeltaMerge/Segment.cpp`:
- Around line 3735-3742: Change the multi-stage late-materialization adoption
log in the segment stream-construction path to LOG_DEBUG instead of LOG_INFO,
keeping the existing message and arguments unchanged.

In `@dbms/src/Storages/SelectQueryInfo.h`:
- Around line 63-64: Rename the new multi-stage late-materialization API
identifiers from snake_case to camelCase throughout the propagation chain:
update fields in dbms/src/Storages/SelectQueryInfo.h lines 63-64, counters in
dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h lines
27-28, interpreter state in dbms/src/Flash/Coprocessor/DAGStorageInterpreter.h
line 171, read options in dbms/src/Storages/DeltaMerge/DeltaMergeStore.h lines
208-209, and propagated parameters plus declarations in
dbms/src/Storages/DeltaMerge/Segment.h lines 232-233, 795-796, and 808-809.
Rename constructor parameters and backing members in
dbms/src/Operators/DMSegmentThreadSourceOp.h lines 41-42 and update all
corresponding uses in dbms/src/Operators/DMSegmentThreadSourceOp.cpp.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a55c75d4-6aae-4811-885c-55a128d74722

📥 Commits

Reviewing files that changed from the base of the PR and between 8b22d94 and ab6736a.

📒 Files selected for processing (31)
  • dbms/src/Flash/Coprocessor/DAGContext.cpp
  • dbms/src/Flash/Coprocessor/DAGContext.h
  • dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
  • dbms/src/Flash/Coprocessor/DAGStorageInterpreter.h
  • dbms/src/Flash/Statistics/ExecutorStatistics.h
  • dbms/src/Interpreters/Settings.h
  • dbms/src/Operators/DMSegmentThreadSourceOp.cpp
  • dbms/src/Operators/DMSegmentThreadSourceOp.h
  • dbms/src/Storages/DeltaMerge/DMSegmentThreadInputStream.h
  • dbms/src/Storages/DeltaMerge/DeltaMergeStore.cpp
  • dbms/src/Storages/DeltaMerge/DeltaMergeStore.h
  • dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.cpp
  • dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationBlockInputStream.h
  • dbms/src/Storages/DeltaMerge/MultiStageLateMaterializationRuntimeStats.h
  • dbms/src/Storages/DeltaMerge/Remote/RNWorkerPrepareStreams.h
  • dbms/src/Storages/DeltaMerge/Segment.cpp
  • dbms/src/Storages/DeltaMerge/Segment.h
  • dbms/src/Storages/DeltaMerge/SegmentReadTask.cpp
  • dbms/src/Storages/DeltaMerge/SegmentReadTask.h
  • dbms/src/Storages/DeltaMerge/SegmentReadTaskPool.cpp
  • dbms/src/Storages/DeltaMerge/SegmentReadTaskPool.h
  • dbms/src/Storages/DeltaMerge/tests/gtest_dm_segment.cpp
  • dbms/src/Storages/DeltaMerge/tests/gtest_dm_vector_index.cpp
  • dbms/src/Storages/DeltaMerge/tests/gtest_segment_read_task.cpp
  • dbms/src/Storages/DeltaMerge/tests/gtest_segment_read_task_pool.cpp
  • dbms/src/Storages/DeltaMerge/tests/gtest_skippable_block_input_stream.cpp
  • dbms/src/Storages/SelectQueryInfo.cpp
  • dbms/src/Storages/SelectQueryInfo.h
  • dbms/src/Storages/StorageDeltaMerge.cpp
  • dbms/src/Storages/StorageDisaggregatedRemote.cpp
  • docs/design/2026-07-25-multi-stage-late-materialization.md

Comment thread dbms/src/Flash/Coprocessor/DAGContext.cpp
Comment thread dbms/src/Storages/DeltaMerge/Remote/RNWorkerPrepareStreams.h

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp (1)

92-109: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use std::string_view for the read-only executor ID.

executor_id is only used synchronously for lookup and is not mutated. As per coding guidelines, use std::string_view for read-only string parameters.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp` around lines 92 - 109,
Update addProfileRowsToExecutorRowsOverride to accept the read-only executor_id
parameter as std::string_view instead of const String &, preserving the existing
synchronous lookup and row aggregation behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp`:
- Around line 92-109: Update addProfileRowsToExecutorRowsOverride to accept the
read-only executor_id parameter as std::string_view instead of const String &,
preserving the existing synchronous lookup and row aggregation behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 94489609-7e61-46f3-b5af-786d91732c06

📥 Commits

Reviewing files that changed from the base of the PR and between 282d286 and 330c612.

📒 Files selected for processing (3)
  • dbms/src/Debug/MockStorage.cpp
  • dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
  • dbms/src/Flash/tests/gtest_executors_with_dm.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • dbms/src/Flash/tests/gtest_executors_with_dm.cpp
  • dbms/src/Debug/MockStorage.cpp

@windtalker
windtalker force-pushed the feature/multi-stage-late-materialization branch from 0b18458 to 85f5a69 Compare July 26, 2026 14:23
@windtalker

Copy link
Copy Markdown
Contributor Author

/test pull-integration-test

@windtalker

Copy link
Copy Markdown
Contributor Author

/run pull-integration-test

Comment thread dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp
remote_builder.getCurIOProfileInfos(),
/*is_append=*/true);
auto remote_profile_infos = remote_builder.getCurProfileInfos();
dag_context.addProfileRowsToExecutorRowsOverride(table_scan.getTableScanExecutorID(), remote_profile_infos);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

addProfileRowsToExecutorRowsOverride snapshots remote_profile_infos[*]->rows here while the remote pipeline has only been built, not executed, so the value is still zero. Later operator updates do not propagate to the atomic override, and ExecutorStatistics replaces the normally aggregated rows with that override. Remote-only queries therefore report actRows=0, while mixed local/remote queries omit remote rows. Please retain and aggregate the remote profiles at statistics collection time, or update the override from the remote completion path; the regression test should use real remote-only and mixed execution paths instead of calling the helper after setting synthetic rows.

Source: rule/WJHUANG2016-RE-002 | Second Opinion

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 27, 2026
@windtalker windtalker changed the title Add adaptive multi-stage late materialization Add multi-stage late materialization Jul 27, 2026
@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 27, 2026
@windtalker

Copy link
Copy Markdown
Contributor Author

/test pull-unit-test

@ti-chi-bot

ti-chi-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gengliqi, JaySon-Huang
Once this PR has been reviewed and has the lgtm label, please assign yudongusa 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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 27, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-07-27 10:40:24.253529705 +0000 UTC m=+1833410.289624751: ☑️ agreed by JaySon-Huang.
  • 2026-07-27 11:21:39.609534598 +0000 UTC m=+1835885.645629654: ☑️ agreed by gengliqi.

@windtalker

Copy link
Copy Markdown
Contributor Author

/hold

@ti-chi-bot ti-chi-bot Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 27, 2026
@ti-chi-bot ti-chi-bot Bot removed the approved label Jul 27, 2026
@windtalker

Copy link
Copy Markdown
Contributor Author

/hold cancel

@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 27, 2026
@windtalker

Copy link
Copy Markdown
Contributor Author

/test pull-unit-test

@windtalker

Copy link
Copy Markdown
Contributor Author

/hold

@ti-chi-bot ti-chi-bot Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 27, 2026
@windtalker

Copy link
Copy Markdown
Contributor Author

/test pull-integration-test

1 similar comment
@windtalker

Copy link
Copy Markdown
Contributor Author

/test pull-integration-test

@windtalker

Copy link
Copy Markdown
Contributor Author

/hold cancel

@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit 8a01c28 into pingcap:feature/release-8.5-materialized-view Jul 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants