Skip to content

MergeTree Continuous Query - #105114

Merged
Michicosun merged 72 commits into
masterfrom
merge_tree_continuous_reading
May 27, 2026
Merged

Michicosun merged 72 commits into
masterfrom
merge_tree_continuous_reading

Conversation

@Michicosun

@Michicosun Michicosun commented May 16, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

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

This patch adds support for continuous query for merge tree tables implemented via a series of snapshot reads. This is a first step toward general support for streaming queries.

Watermarks support is present in the different pr: #106169


Note

High Risk
Introduces an experimental STREAM table modifier that changes query parsing/analysis and the MergeTree read pipeline, plus adds new background scheduling and subscription logic; regressions could impact core read paths and schema operations for MergeTree tables.

Overview
Adds an experimental continuous-query mode via FROM t STREAM [CURSOR {...}], including a new parser/AST (ASTStreamSettings) and propagation through analyzer TableExpressionModifiers (with hashing/formatting).

Implements MergeTree streaming reads as a snapshot loop: ReadFromMergeTree switches to a new MergeTreeCommitOrderSequentialSource when SelectQueryInfo::isStream() is set, maintains per-partition cursors (CursorTree/CursorUtils), and disables incompatible behaviors (index analysis in the usual path, NullSource for empty parts, parallel replicas).

Adds storage-side support and coordination: IStorage::supportsStreaming(), MergeTree/ReplicatedMergeTree enable it, streaming subscriptions (SubscriptionManager, MergeTreeBoundsSubscription, WakeupFd) are enriched via a new background assignee, and schema-changing ALTER is rejected while a streaming subscription exists. Includes client/interpreter tweaks to disable pretty-output squashing for streaming queries, new error codes, and new gtests/stateless tests covering parsing and streaming behavior.

Reviewed by Cursor Bugbot for commit 71ff944. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/Core/Streaming/CursorTree.cpp Resolved
Comment thread src/Analyzer/QueryTreeBuilder.cpp Resolved
Comment thread src/Analyzer/TableExpressionModifiers.h Resolved
Comment thread src/Analyzer/Resolve/QueryAnalyzer.cpp Resolved
Comment thread src/Parsers/ParserStreamSettings.cpp Resolved

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2d50f53. Configure here.

@clickhouse-gh

clickhouse-gh Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.50% 76.60% +0.10%

Changed lines: 53.51% (618/1155) | lost baseline coverage: 64 line(s) · Uncovered code

Full report · Diff report

@Michicosun
Michicosun enabled auto-merge May 27, 2026 09:00
@Michicosun
Michicosun added this pull request to the merge queue May 27, 2026
Merged via the queue into master with commit 58cab36 May 27, 2026
162 of 165 checks passed
@Michicosun
Michicosun deleted the merge_tree_continuous_reading branch May 27, 2026 09:25
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 27, 2026
@alexey-milovidov alexey-milovidov mentioned this pull request Sep 20, 2026
47 of 72 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature 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.

4 participants