Repository navigation
Fix Iceberg _row_id pruning dropping rows of a rewritten file that has no row lineage statistics - #124591
Conversation
…ge statistics `addRowLineageHyperrectangles` took "some column of the manifest entry has `column_sizes`" as proof that a lineage column with no statistics is absent from the data file, and pruned `_row_id` / `_last_updated_sequence_number` on the inherited block `[first_row_id, first_row_id + record_count - 1]` / `[sequence_number, sequence_number]`. The Iceberg spec makes every metric map optional and a missing id means unknown, so a copy-on-write rewritten file whose materialized values lie below that block was skipped and its rows lost (ClickHouse#124271). The branch came with ClickHouse#115603. Without declared bounds a lineage column now gets the existing fallback `[0, top of the inherited block]`: a materialized row id is below the table's `next-row-id` and a copied sequence number belongs to an earlier commit. The new integration test strips only the lineage statistics from a Spark copy-on-write manifest. Seven count assertions that encoded the old lower bound are updated to the fallback numbers, and the wrapped-block probe moves to `_row_id >= 20`, which still distinguishes the overflow guard. Closes ClickHouse#124271 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings), plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261008-095400 |
|
Workflow [PR], commit [c2435ca] Summary: ✅
AI ReviewSummaryThis PR removes an unsafe Iceberg v3 pruning shortcut for Final Verdict
LLVM Coverage ReportMeasured on commit c2435ca.
Changed lines: Changed C/C++ lines covered: 14/14 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 13 s compile time in total, 7 of them have a recent master baseline. |
|
@SmitaRKulkarni @scanhex12 this is not my expertise to review |
Antalya 26.8 Backport of ClickHouse#124591 - Fix Iceberg `_row_id` pruning dropping rows of a rewritten file that has no row lineage statistics
Closes: #124271
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a filter on the
Icebergv3 virtual columns_row_idor_last_updated_sequence_numberreturning no rows for a data file rewritten by copy-on-write, when the manifest has statistics for the table columns but not for the row lineage columns. Closes #124271.Description
On 26.9 (
v26.9.12.8-stable),SELECT id FROM icebergS3(...) WHERE _row_id = 1returns no rows for a format-version 3 data file whose rows keep their row ids after a copy-on-write rewrite (so they lie below the file'sfirst_row_id), when its manifest entry has statistics for the table columns but none for_row_id. The same happens for_last_updated_sequence_number.addRowLineageHyperrectanglestook "some column of the entry hascolumn_sizes" as proof that a lineage column without statistics is absent from the file, and pruned on the inherited block[first_row_id, first_row_id + record_count - 1]([sequence_number, sequence_number]). In the spec every metric map is optional and a missing id means unknown. The branch came with #115603.The branch is removed. Without declared bounds a lineage column gets the existing fallback
[0, top of the inherited block], already used for files without statistics: a materialized row id is below the table'snext-row-id, so belowfirst_row_id, and a copied_last_updated_sequence_numberbelongs to an earlier commit.Cost: files written without lineage statistics (Spark and ClickHouse appends) lose the lower side of the range. Over five 10-row appends
_row_id = 25now skips 2 files instead of 4, and_last_updated_sequence_number = 2skips 1 instead of 4. Filters above a value (_row_id >= X, the incremental_last_updated_sequence_number > Nread) prune as before.A new integration test strips only the lineage statistics from a Spark copy-on-write manifest: it fails without the fix (
'' == '0') and passes with it. Seven count assertions that encoded the old lower bound now match the numberstest_pruning_without_column_statisticsalready asserts for the same fallback. The wrapped-block probe moved to_row_id >= 20, which still fails when the overflow guard is removed.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124591]
Version info
26.10.1.2047-master(included in26.10and later)