Repository navigation
Fix Iceberg _row_id and _last_updated_sequence_number returning stored values for data files without first_row_id - #130117
Conversation
…row_id` A data file without `first_row_id` (every data file of a snapshot written before the table was upgraded to format version 3) has NULL `_row_id` and `_last_updated_sequence_number` for every row, also where the file stores values in these reserved columns (spec, "Row Lineage for Upgraded Tables"). The source passed the stored values on; it now drops them for such a file, so both columns take the NULL path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`getFormatFilter` kept the conjuncts on `_row_id` and `_last_updated_sequence_number` for Iceberg, so the Parquet reader pruned row groups, pages and dictionaries by the statistics of the column stored in the data file. Those statistics do not cover rows that store NULL and inherit the value, so a filter above the stored maximum skipped row groups with matching inherited values. After a Spark copy-on-write `UPDATE` the rewritten file stores `_last_updated_sequence_number` [1, NULL, 1, 1], and `WHERE _last_updated_sequence_number = 2` lost the updated row with the default `input_format_parquet_filter_push_down = 1`. The lineage columns are now treated like every other virtual column added after the format; the filter is still applied after the source, and the manifest-level pruning keeps skipping whole files where declared bounds allow it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… `first_row_id` 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 of the same tree (0 blocker, 0 major).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-11:20261108-094800 |
|
Workflow [PR], commit [6e96952] Summary: ✅
AI ReviewSummaryThis PR fixes Final VerdictStatus: ✅ Approve |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261108-085000 |
|
cc @scanhex12 @alesapin, could you review this and add the |
CI finish ledger - 30c9a78Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261108-143005 |
…lineage-without-first-row-id # Conflicts: # src/Storages/prepareReadingFromFormat.h
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, 17 s compile time in total, 7 of them have a recent master baseline. |
Closes: #130021
Related: #130100
Related: #130010
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
_row_idand_last_updated_sequence_numberof anIcebergdata file that has nofirst_row_id(data written before the table was upgraded to format version 3): they are nowNULLalso when the file stores values in these columns. Closes #130021.Description
On
v26.10.2.103-stable, the DuckDB tablerow_lineage_stored_columnsof #130021 read at snapshot1111111111111111111(written before the upgrade to format version 3, so its data file has nofirst_row_id) returns100,103in_row_idand7,9in_last_updated_sequence_number, the values its Parquet file stores. The spec reads both columns as NULL for every row of such a file, whatever it stores.Two places used the stored values:
StorageObjectStorageSource::generatepassed the stored columns on, and a non-NULL stored value wins over the inherited one; only the inherited half checkedfirst_row_id.getFormatFilterkept the lineage conjuncts in the filter pushed into the format, so Parquet skipped row groups by the stored statistics before the values were reset (WHERE _row_id IS NULLreturned 0 of 4 rows), and the query condition cache could replay that verdict for an older snapshot. Fix Iceberg_row_idand_last_updated_sequence_numberfilters losing rows of files that store lineage values #130100 (merged) fixed this one.Now
generatedrops the stored lineage columns of a file withoutfirst_row_id, so both columns are NULL. The PR carried #130100's commit until it merged; after merging master, the diff is this change and its test.Validation: the new test
05583_iceberg_v3_stored_row_lineage_without_first_row_idfails on master (re-checked on 2026-11-22) and passes 50/50; the Iceberg row lineage integration tests pass.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/130117]