Skip to content

Backport #122512 to 26.8: Fix constant-condition if/multiIf GROUP BY keys with the identifier resolve cache and group_by_use_nulls - #132939

Open
robot-ch-test-poll3 wants to merge 1 commit into
26.8from
backport/26.8/122512
Open

robot-ch-test-poll3 wants to merge 1 commit into
26.8from
backport/26.8/122512

Conversation

@robot-ch-test-poll3

Copy link
Copy Markdown
Contributor

Original pull-request #122512

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

… BY keys with the identifier resolve cache and `group_by_use_nulls`
@robot-ch-test-poll3 robot-ch-test-poll3 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 Nov 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [7581b56]

Summary: ❌

job_name test_name status info comment
Docker keeper image FAIL
clickhouse/clickhouse-keeper:head-distroless-amd64 FAIL cidb
docker library image test (clickhouse/clickhouse-keeper:head-distroless-amd64) FAIL cidb
Stateless tests (amd_asan_ubsan, distributed plan, parallel) FAIL
05385_group_by_use_nulls_constant_condition_group_by_key FAIL cidb

@groeneai

Copy link
Copy Markdown
Collaborator

This backport, and #132940 for 26.9, bring two regressions that #122512 caused on master and #125828 fixed there: #125803 (rolled-up rows get the key's value instead of NULL) and #125804 (NOT_FOUND_COLUMN_IN_BLOCK for a tuple key in ORDER BY). #125828 has no backport label, and 26.10 already ships #122512 without it.

Measured with clickhouse local on the CI builds of both heads and on official builds:

26.8.41.13 this PR @ 7581b56 26.9.33.12 #132940 @ 3110004 26.10.7.24 master
Q1 (#125803), expected 3 3 0 3 0 0 3
Q2 (#125804) correct NOT_FOUND_COLUMN_IN_BLOCK correct NOT_FOUND_COLUMN_IN_BLOCK NOT_FOUND_COLUMN_IN_BLOCK correct
-- Q1
SELECT count() FROM (SELECT n, if(n = 5, toString(n), if(1, if(n > 1, 'p', 'q'), 'z')) AS e FROM (SELECT arrayJoin([1, 2]) AS n) GROUP BY ROLLUP(n, if(1, if(n > 1, 'p', 'q'), 'z')) HAVING e IS NULL SETTINGS group_by_use_nulls = 1, optimize_if_chain_to_multiif = 1);
-- Q2
SELECT if(1, tuple(a), tuple(0)) AS k, count() FROM (SELECT number % 3 AS a FROM numbers(10)) GROUP BY ROLLUP(k) ORDER BY k SETTINGS group_by_use_nulls = 1;

#125828 merges without conflicts onto the heads of this PR and #132940 and onto 26.10, so pr-must-backport on #125828 would cover all three.

Separately, the tests of #122512 fail on 26.8: SET allow_correlated_subqueries = 1 is UNKNOWN_SETTING there (26.8 only has allow_experimental_correlated_subqueries), and the 26.8 old-analyzer stateless jobs cannot run 05385's correlated subqueries or 05386's EXPLAIN QUERY TREE. Commit eafe038 on top of this PR's head fixes both (3 test lines). With it, both tests match their references on this PR's build with enable_analyzer 0 and 1, and still fail on 26.8.41.13:

git fetch https://github.com/groeneai/ClickHouse fix-26.8-backport-122512-tests
git push origin FETCH_HEAD:backport/26.8/122512

This branch has not been deployed

No deployments
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.

4 participants