Fix crash in Iceberg due to type confusion#109551
Conversation
|
Workflow [PR], commit [8556ac7] Summary: ✅
AI ReviewSummaryThis PR fixes the immediate Findings
Final VerdictChanges requested. |
|
Backport labels have been automatically added based on https://github.com/clickhouse/clickhouse-core-incidents/issues/1882 Labels added:
These labels ensure backport PRs are properly created for each affected release version. The release automation will create backport PRs as needed based on these labels. |
|
Updating the branch to fix the |
| /// Take the type from the delete file header rather than from the table schema: | ||
| /// the nullability of a column in the delete file may differ from its nullability | ||
| /// in the table schema, and the columns read below have exactly the header's types. | ||
| block_for_set.insert(ColumnWithTypeAndName(delete_file_header.getByPosition(position_in_delete_file).type, name_and_type.name)); |
There was a problem hiding this comment.
Using the delete-file header type fixes the insertRangeFrom type confusion, but it still leaves nullable equality keys semantically wrong downstream. This path later builds the predicate with plain notIn (see IcebergMetadata.cpp:1313), and for a nullable left-hand key ClickHouse returns NULL rather than 1/0 when the row value itself is NULL (for example SELECT NULL NOT IN (1) is NULL). FilterDescription then turns that nullable filter result into false, so every data row whose equality key is NULL gets dropped whenever an equality-delete filter is present, even if the delete set contains no NULL at all.
That means the reverse direction claimed in the PR body (required delete file -> optional table) is still incorrect today for real nullable rows. This probably needs a null-safe predicate here (notNullIn or an explicit null-aware comparison) plus a regression that keeps NULL rows when the delete file only contains non-NULL keys.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 6/6 (100.00%) · Uncovered code |
|
So I see Spark doesn't generate equality deletes. Let me add this coverage in #109194 |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
Backport #109551 to 26.6: Fix crash in Iceberg due to type confusion
Linked issues
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a crash when reading Iceberg tables with equality delete files. If a column is nullable in the equality delete file but non-nullable in the table schema (or vice versa), the values read from the delete file were inserted into a column of a different type through an unchecked cast (a column type confusion), corrupting the column and crashing the server.
Version info
26.7.1.664(included in26.7and later)26.6.2.50