Skip to content

Stabilize 04201_trivial_count_with_additional_filter on 25.8 - #108904

Merged
alexey-milovidov merged 1 commit into
ClickHouse:25.8from
groeneai:stabilize-04201-trivial-count-25.8
Jun 30, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:25.8from
groeneai:stabilize-04201-trivial-count-25.8

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

...

Description

Stabilizes 04201_trivial_count_with_additional_filter on the 25.8 release branch (separate PR requested by alexey-milovidov on #108763, where this was the only red and is unrelated to that SSL-auth backport).

The test captures EXPLAIN PIPELINE output with its indentation. The 25.8 copy pinned no settings, so under the fuzzer's randomized max_threads the (ReadFromMergeTree) block loses one Resize nesting level (8 -> 6 spaces) and the committed reference no longer matches. Confirmed via the test runner on a 25.8 binary: the old test fails when max_threads=1 is injected, passes when it is >= 2.

Fix: pin max_threads = 1, optimize_use_implicit_projections = 0, optimize_use_projections = 0 (same settings master pins via #104296) so the pipeline shape is deterministic, and regenerate the reference against a 25.8 binary. Query-level SET max_threads = 1 overrides any value the runner injects, so the output is identical across injected max_threads 1/2/4/8/16.

The master reference is not cherry-pickable to 25.8: master's pipeline shows a (Filter)/FilterTransform wrapper from a17b94ec153 ("Skip the recursive Planner after trivial-count optimization"), which is not in 25.8. The 25.8 reference therefore differs (no Filter wrapper).

Test-only change. Validated on 25.8.25.1: fails 3/3 without the fix under injected --max_threads 1; passes 5/5 with it, 40/40 with random settings on.

The test captures EXPLAIN PIPELINE output with its indentation. On 25.8 the
test pinned no settings, so under the fuzzer's randomized max_threads the
(ReadFromMergeTree) block loses one Resize nesting level (8 -> 6 spaces) and
the reference no longer matches.

Pin max_threads = 1, optimize_use_implicit_projections = 0 and
optimize_use_projections = 0 so the pipeline shape is deterministic, and
regenerate the reference against a 25.8 binary. The 25.8 pipeline shape differs
from master (no Filter/FilterTransform wrapper) because a17b94e is not in
25.8, so the master reference is not cherry-pickable here.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. On a 25.8 binary via clickhouse-test: old (unpinned) test fails 3/3 when --max_threads 1 is injected; the (ReadFromMergeTree) block prints at 6 spaces vs the reference's 8.
b Root cause explained? The test captures EXPLAIN PIPELINE text with indentation. With no pinned max_threads, the fuzzer's --max_threads 1 removes one Resize nesting level (8 -> 6 spaces), so the committed 25.8 reference (8-space form, generated at max_threads >= 2) no longer matches.
c Fix matches root cause? Yes. Pinning max_threads = 1 (+ optimize_use_implicit_projections = 0, optimize_use_projections = 0, matching master #104296) makes the pipeline shape deterministic; the reference is regenerated to the pinned shape.
d Test intent preserved / new tests added? Yes. The three assertions (trivial-count disabled when the filter targets this table; still fires when it targets another table; baseline) are unchanged. Only the captured indentation and the pinned settings change.
e Both directions demonstrated? Yes. Without fix: 3/3 FAIL under injected --max_threads 1. With fix: 5/5 PASS under injected --max_threads 1, 40/40 PASS with random settings on, 5/5 PASS default. Output md5 identical across injected --max_threads 1/2/4/8/16.
f Fix is general across code paths? N/A (flaky test setting fix, not a code bug).
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (flaky test setting fix, not a code bug). The added inert %Resize%/%Filter% capture terms were verified to match nothing under max_threads=1 on 25.8, so they cannot reintroduce flakiness; they keep the test text aligned with master.
h Backward compatible? (maintainer-approved exception only) N/A (flaky test setting fix, not a code bug).
i Invariants and contracts preserved? N/A (flaky test setting fix, not a code bug).

Built against a 25.8 binary (25.8.25.1) because the master reference is not cherry-pickable: master's pipeline has a (Filter)/FilterTransform wrapper from a17b94ec153 ("Skip the recursive Planner after trivial-count optimization"), which is not in 25.8.

Session id: cron:clickhouse-worker-slot-1:20260630-064200

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov - the separate 25.8 stabilization you asked for on #108763. Test-only: pins max_threads = 1 (+ disables implicit/explicit projections, matching master #104296) and regenerates the .reference against a 25.8 binary so the EXPLAIN PIPELINE indentation is deterministic. The 25.8 reference differs from master's (no Filter wrapper, since a17b94e is not in 25.8).

@clickhouse-gh

clickhouse-gh Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [d080256]

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants