Skip to content

Unified Internal Streaming Reading Plan - #111821

Merged
Michicosun merged 17 commits into
masterfrom
streaming/combined_internal_query_plan
Jul 30, 2026
Merged

Michicosun merged 17 commits into
masterfrom
streaming/combined_internal_query_plan

Conversation

@Michicosun

@Michicosun Michicosun commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

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

This patch changes how the internal query plan for streaming will be constructed and optimized.

Fixes the double optimize problem with direct text index read optimization. Text index is not idempotent to optimize.

Version info

  • Merged into: 26.8.1.404 (included in 26.8 and later)

@clickhouse-gh

clickhouse-gh Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [97a393b]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_asan_ubsan, db disk, old analyzer, 3/6) FAIL
test_jbod_load_balancing/test.py::test_jbod_load_balancing_least_used_next_disk FAIL cidb

AI Review

Summary

This PR rewrites MergeTreeCommitOrderSequentialSource to build one internal plan per readable partition, unite those plans with UnionStep, and optimize the combined plan once so direct text-index reads are not rewritten twice. The code path looks coherent and the new text-index regression test covers the motivating single-partition case, but the central multi-partition unified-plan path is still not proven by the current tests.

PR Metadata
  • Changelog category: Improvement matches the change.
  • Changelog entry: required, but the current text is too implementation-focused for CHANGELOG.md. Suggested replacement: Fixed FROM ... STREAM queries to optimize direct text-index reads correctly when building the internal streaming read plan.
Findings

⚠️ Majors

  • [dismissed by author -- https://github.com/Unified Internal Streaming Reading Plan #111821#discussion_r3667162797] [src/Storages/MergeTree/Streaming/MergeTreeCommitOrderSequentialSource.cpp:223] The refactor's contract is that one MergeTreeCommitOrderSequentialSource can now merge several partition branches inside one internal UnionStep plan, but the current suite never drives one source through more than one partition. 04235_streaming_queries_partitioned_merge_tree.sh and 04235_streaming_queries_replicated_merge_tree.sh still open one STREAM query per partition, and 04235_streaming_queries_text_index_direct_read.sql still reads the single all partition, so cursor advancement across multiple partition branches remains unproven.
    Suggested fix: add one focused stateless test that forces a single streaming source (for example with max_threads = 1), runs one SELECT ... STREAM on a partitioned table without a partition predicate, and inserts into multiple partitions across several snapshots.
Final Verdict

The motivating single-partition text-index regression looks addressed, but I would still want one focused multi-partition streaming test before treating the unified internal-plan rewrite as fully covered.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 24, 2026
@rienath rienath self-assigned this Jul 27, 2026

@rienath rienath 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.

Could you add a PR description? Without digging it's impossible to know that this isn't just a refactoring. Also, consider promoting to improvement or bug-fix as added test previously would throw

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default and removed pr-not-for-changelog This PR should not be mentioned in the changelog labels Jul 29, 2026
@Michicosun

Copy link
Copy Markdown
Member Author

Bugfix validation is broken with streaming queries

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements and removed pr-bugfix Pull request with bugfix, not backported by default labels Jul 29, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.40% 86.40% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.60% 78.50% -0.10%

Changed lines: Changed C/C++ lines covered: 141/152 (92.76%) · Uncovered code

Full report · Diff report

@Michicosun
Michicosun added this pull request to the merge queue Jul 30, 2026
Merged via the queue into master with commit f59c5ab Jul 30, 2026
178 of 180 checks passed
@Michicosun
Michicosun deleted the streaming/combined_internal_query_plan branch July 30, 2026 08:42
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements 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