Skip to content

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

Merged
alexey-milovidov merged 3 commits into
26.3from
continue-pr-130717-backport-130192
Nov 15, 2026
Merged

alexey-milovidov merged 3 commits into
26.3from
continue-pr-130717-backport-130192

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Backport of #130192 to 26.3: keep the NULL partition in Delta Lake partition pruning when the filter's set holds NULL.

This supersedes #130717. The 26.3 branch history was rewritten, so the branch of that PR carries 215 commits that are no longer ancestors of 26.3 and the check_backport_branch.py hook fails (a backport PR must have at most 50 commits). Fixing that would need a history rewrite of the published branch, so this PR re-applies the same three commits (the robot backport, the 26.3 adaptation by groeneai, and the test reference adjustment) on top of the current 26.3. The resulting diff against 26.3 is byte-identical to the effective diff of #130717.

Related: #130717
Related: #130192

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Keep the NULL partition in Delta Lake partition pruning when the filter's set holds NULL.

🤖 Generated with Claude Code

Version info

  • Merged into: 26.3.65.7

robot-clickhouse and others added 3 commits November 15, 2026 18:12
…tition pruning when the filter's set holds `NULL`

(cherry picked from commit 0cc79e2)
… can run

26.3's KeyDescription::getKeyFromAST takes no `virtuals` argument (#102827 is
not on 26.3), so drop the `{}` the cherry-pick carried.

The test built its Delta tables with INSERT INTO FUNCTION deltaLakeLocal under
allow_delta_lake_writes. On 26.3 that setting is still called
allow_experimental_delta_lake_writes, and a partitioned INSERT of a NULL value
fails with NOT_IMPLEMENTED (#111793 is not on 26.3). Write the same tables by
hand instead, as 26.3's 05237 test does: Parquet data files through file() and
one add action per file, a NULL partition value committed as a JSON null under
__HIVE_DEFAULT_PARTITION__.

Two cases fail on 26.3 with and without this change, so they are dropped:
`ifNull(p, 0) IN (0)` prunes the NULL partition (a MergeTree table partitioned
by the same Nullable column returns the same wrong rows on 26.3), and
`has([NULL, 'a'], s)` throws CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN (#115647 is
not on 26.3). On 26.3 the fix keeps the NULL partition's file for
`has([5, 7], p)`, so that case prunes 1 file instead of 2 (rows unchanged):
26.3 builds no set index for a UInt8 array over a Nullable(Int64) key; 26.3's
MergeTree partition pruning does not use that predicate on a Nullable key either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 25da41d)
…prunes no file

On 26.3 the Nullable key condition does not prove that this predicate is
false for the `NULL` partition, so the partition pruner keeps its file and
prunes 0 files instead of 1. The rows are the same; keeping a file is the
conservative outcome. Reproduced with the `build_arm_release` binary of this
PR (26.3.61.91); the other cases match the reference.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=130717&sha=a3a2d22f6027fc8c95c20735d2a9c17fa472b7a0&name_0=BackportPR&name_1=Stateless%20tests%20%28amd_asan%2C%20distributed%20plan%2C%20parallel%2C%202%2F2%29
PR: #130717

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 715faa4)
@alexey-milovidov alexey-milovidov added pr-bugfix Pull request with bugfix, not backported by default pr-backport Changes, backported to release branch. Do not use manually - automated use only! labels Nov 15, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [f468fb6]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Nov 15, 2026
@alexey-milovidov
alexey-milovidov merged commit cced2b5 into 26.3 Nov 15, 2026
43 checks passed
@alexey-milovidov
alexey-milovidov deleted the continue-pr-130717-backport-130192 branch November 15, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. 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.

3 participants