Repository navigation
Support row lineage assignment on commit - #4102
cayetanobv wants to merge 2 commits into
Conversation
39e7fd9 to
551c5f4
Compare
|
The Python 3.10 failure is not from this change. |
551c5f4 to
fc5db85
Compare
|
This builds on #3624; the first commits come from that PR, and I'll rebase once it merges. @Fokko @kevinjqliu could one of you take a look when you have a moment? Without a review, the stale bot will close both PRs in about a month, as happened to #3551, and the V3 write work would drop out of the queue. Thanks! |
Add ManifestWriterV3 and ManifestListWriterV3, rebased onto main, which now binds every record to the V3 layout. The manifest list writer assigns first-row-id to data manifests that lack one, clears it on delete manifests as Java does, and works on a fresh record so the caller's manifest files are never mutated. The snapshot producer passes the table's next-row-id to the V3 manifest list writer. Closes apache#3620 Generated-by: Claude Code
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that's incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
V3 snapshots set first-row-id but not added-rows, so REST catalogs reject every V3 commit and next-row-id is lost after the first one. Set added-rows to the row IDs that the V3 manifest list writer assigns, as Java does, and remove the unused _calculate_added_rows. Closes apache#3621
fc5db85 to
05b4198
Compare
Closes #3621 (part of #1551). Stacked on #3624, which adds
ManifestListWriterV3. Only the last commit belongs to this PR; I will rebase once #3624 merges.Rationale for this change
Every commit to a V3 table fails on a REST catalog.
_SnapshotProducer._commitsetsfirst-row-idon the new snapshot but never setsadded-rows, and the spec requires both together. The REST fixture rejects the snapshot:Without a server check, the table metadata goes wrong instead.
add_snapshotcomputesnext-row-idfromadded-rows, sonext-row-idbecomesNoneafter the first commit and the next commit fails.This PR sets
added-rowstowriter.next_row_id - first_row_id, which is the number of row IDsManifestListWriterV3assigned. Java'sSnapshotProducercomputes it the same way. The count includes existing rows in manifests that had nofirst_row_id, sonext-row-idalways moves past every assigned ID.It also removes
_calculate_added_rows. Nothing called it, and it counted onlyadded_rows_countfrom the snapshot's own manifests, which would undercount the rows that the writer assigns.Out of scope: a V3 table created by
new_table_metadatahasnext-row-id = None, so a commit to it still fails. A REST server sets it to 0 on create, which hides this. That belongs with writing V3 metadata (#3551).Rewritten manifests do not keep row IDs on EXISTING entries yet, so a merge append or partial delete moves them. #3972 fixes this by inheriting
first_row_idon read.added-rowsalready matches Java in both cases.Are these changes tested?
Yes. Three new tests in
tests/table/test_snapshots.pycommit to an empty V3 table inside a transaction, because writing a V3metadata.jsonis not supported yet:(first_row_id, added_rows)is(0, 3), then(3, 3), andnext-row-idis 6add_files:(0, 3),next-row-idis 3(3, 2), andnext-row-idis 5All three fail without the change. The unit suite passes locally.
This PR also un-skips the integration test
test_v3_write_and_read_row_lineage. It now appends twice and reads_row_idand_last_updated_sequence_numberwith Spark (Iceberg 1.11.0), which must see row IDs 0 to 5 with sequence numbers 1 and 2. It passes with the change and fails without it on the sameInvalid added-rowserror.I also ran this script against
apache/iceberg-rest-fixture(sha256:db8de90b…) with the RustFS warehouse fromdev/docker-compose-integration.yml:Before, on #3624 (
c152089d):After:
Are there any user-facing changes?
No API changes. Commits to V3 tables through a REST catalog now succeed.
Written with Claude Code (Claude Opus 5.5) and reviewed by me. One path has no test:
added-rowsfor tables upgraded from V2, which follows Java but needs #3622 to exercise.