Skip to content

Split Streaming Read Round into Aligned Metadata and Data Streams - #116128

Merged
Michicosun merged 11 commits into
masterfrom
split_streaming_read_round
Aug 26, 2026
Merged

Michicosun merged 11 commits into
masterfrom
split_streaming_read_round

Conversation

@Michicosun

@Michicosun Michicosun commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

This patch changes the unified data stream in which watermarks must be calculated before filters, with an aligned, split-stream approach ensuring correct progress-tracking semantics.

Now watermarks will be calculated on the metadata stream and aligned with the filtered data stream. This way, we can push down arbitrary filters to filter data while calculating the watermark expression over all data.


Workflow [PR]
Sync PR [sync-upstream/pr/116128]

@clickhouse-gh

clickhouse-gh Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [18b0cb2]

Summary: ✅


AI Review

Summary

This PR splits STREAM ... WATERMARK ... reads into a narrow metadata stream plus a filtered data stream, then aligns them by (_block_number, _block_offset) so watermark calculation can ignore pushed-down filters. The correctness fixes from the earlier discussion look addressed, but the current implementation unconditionally takes the split path for every watermark query, which introduces a predictable extra read and sort on the existing no-filter path.

Findings

⚠️ Majors

  • src/Storages/MergeTree/Streaming/ReadingPlan/buildReadRoundPipeline.cpp:183 The new split/align branch now runs for every watermark query, even when there is no PREWHERE or row-level filter to decouple from watermark calculation. That regresses the existing simple watermark path from one commit-order read/sort to two per partition with no semantic benefit. Keep the old single-plan watermark pipeline when prewhere_info and row_level_filter are both absent, or provide focused measurements showing the extra scan is acceptable.
Final Verdict

Changes requested: the unconditional split path adds a real performance regression to the common no-filter watermark case.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 87.00% 87.10% +0.10%
Functions 91.90% 91.90% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 213/228 (93.42%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 24, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 18b0cb23a with master 2797514bd (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 709.23 MiB 706.22 MiB -3.01 MiB (-0.42%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Object file sizes

5 object files changed (+178.90 KiB total), 1 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Storages/MergeTree/Streaming/ReadingPlan/AlignStreams.cpp.o new 170.39 KiB +170.39 KiB

737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

15 translation units recompiled, 47 s compile time in total, 14 of them have a recent master baseline.

Job report

@Michicosun
Michicosun added this pull request to the merge queue Aug 25, 2026
@Michicosun
Michicosun removed this pull request from the merge queue due to a manual request Aug 25, 2026
@Michicosun
Michicosun added this pull request to the merge queue Aug 26, 2026
Merged via the queue into master with commit 453bfd4 Aug 26, 2026
350 of 352 checks passed
@Michicosun
Michicosun deleted the split_streaming_read_round branch August 26, 2026 08:46
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 26, 2026
@clickgapai

Copy link
Copy Markdown
Contributor

@Michicosun — ClickGap found the following in this PR:

Close anything that's wrong or already addressed.

clickhouse-gh Bot pushed a commit that referenced this pull request Aug 29, 2026
Edited by the NightlyChangelog CI job following .claude/skills/edit-changelog/SKILL.md.

Changelog-revert: 116909 116128 Revert "Split Streaming Read Round into Aligned Metadata and Data Streams"
Changelog-deleted-entry: 116128 [Experimental Feature] [section] * Streaming queries can now push down arbitrary filters while still calculating watermarks over the full input stream, which keeps progress tracking semantics correct. [#116128](#116128) ([Mikhail Artemenko](https://github.com/Michicosun)).
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants