Skip to content

Backport #115227 to 25.8: Do not use the trivial count optimization when the aggregate argument contains arrayJoin - #115468

Merged
vdimir merged 2 commits into
25.8from
backport/25.8/115227
Aug 20, 2026
Merged

vdimir merged 2 commits into
25.8from
backport/25.8/115227

Conversation

@robot-ch-test-poll

@robot-ch-test-poll robot-ch-test-poll commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #115227

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 25.8.31.12

…hen the aggregate argument contains arrayJoin
@robot-ch-test-poll robot-ch-test-poll added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Aug 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [0713259]

`unnest`, a case-insensitive alias of `arrayJoin`, was registered only in
8601d0f (2026-05-16), after the 25.8 branch point. On this branch the
analyzer throws `UNKNOWN_FUNCTION` at the second statement of the test's
single client call, which also skipped statements 3-19: every
`optimize_trivial_count_query = 0` control, the four "optimization is kept"
arms and all four `EXPLAIN` plan assertions. So the backport carried no
verification of the fix it exists to port.

This mirrors the master change c97ca0b (#115505), which dropped the two
`unnest` arms and relocated the alias coverage into `04241_alias_unnest` - a
test that does not exist on this branch, precisely because the alias does not.
Nothing is lost at the guard itself: `FunctionNode::resolveAsFunction` stores
the canonical name, so `hasFunctionNode(..., "arrayJoin")` sees the `unnest`
arms identically to the `arrayJoin` ones, and the surviving 20 reference lines
are byte-identical with and without them.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115468&sha=77b6ebb9c8604d45e2db4a7111e93258704076fa&name_0=BackportPR
Related: #115227
Related: #115505

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@vdimir
vdimir merged commit 7b7f6ff into 25.8 Aug 20, 2026
33 checks passed
@vdimir
vdimir deleted the backport/25.8/115227 branch August 20, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants