Skip to content

Backport #130192 to 26.9: Keep the NULL partition in Delta Lake partition pruning when the filter's set holds NULL - #130720

Merged
clickhouse-gh[bot] merged 3 commits into
26.9from
backport/26.9/130192
Nov 12, 2026
Merged

clickhouse-gh[bot] merged 3 commits into
26.9from
backport/26.9/130192

Conversation

@robot-ch-test-poll3

Copy link
Copy Markdown
Contributor

Original pull-request #130192

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

…tition pruning when the filter's set holds `NULL`
@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 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [34fc4f8]

Summary: ✅

…nes 1 file

On 26.9 `ifNull(p, 0) IN (0)` returns no rows instead of [2] with and
without the backported fix: partition pruning drops the NULL partition,
and a MergeTree table partitioned by the same Nullable column returns
the same wrong rows on 26.9. The case tests another bug, so this
backport's test does not keep it.

On 26.9 the fix keeps the NULL partition's file for `has([5, 7], p)`, so
that case prunes 1 file instead of 2 with the same rows: the untyped
[5, 7] is not used by the Nullable key condition there, while
has([5, 7]::Array(Int64), p) and p IN (5, 7) still prune 2. 26.9's
MergeTree partition pruning does not use the untyped has on a Nullable
key either.

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

Copy link
Copy Markdown
Collaborator

The only failure here is 05576_delta_lake_partition_pruning_null_in_set, in two cases. ifNull(p, 0) IN (0) returns no rows instead of [2] on 26.9 with and without this change, and a MergeTree table partitioned by the same Nullable column returns the same wrong rows on 26.9, so the case tests another bug. And on 26.9 the fix keeps the NULL partition's file for has([5, 7], p), so that case prunes 1 file instead of 2 with the same rows; p IN (5, 7) and has([5, 7]::Array(Int64), p) still prune 2, and 26.9's MergeTree partition pruning does not use the untyped has on a Nullable key either. The other 14 cases pass here, and 7 of them fail on 26.9.25.15, so the fix is needed on 26.9.

A one-commit fix (test only, a fast-forward of backport/26.9/130192) is on my fork: it drops the ifNull case and expects 1 pruned file for has([5, 7], p). I cannot push to this branch; someone with write access can apply it with:

git fetch https://github.com/groeneai/ClickHouse fix-backport-26.9-130192 && git push origin FETCH_HEAD:backport/26.9/130192

Checked with this PR's release build: the test passes (100 of 100 runs).

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Thanks @groeneai. I applied your test-only commit 5f160cc, which drops the ifNull(p, 0) IN (0) case and expects has([5, 7], p) to prune 1 file on 26.9. The failing CI run printed exactly that output. I also merged the latest 26.9, which does not touch the Delta Lake pruner, and pushed 34fc4f8.

@clickhouse-gh
clickhouse-gh Bot merged commit 24d9096 into 26.9 Nov 12, 2026
44 checks passed
@clickhouse-gh
clickhouse-gh Bot deleted the backport/26.9/130192 branch November 12, 2026 18:36
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