Fix DELETED manifest entry snapshot_id in OverwriteFiles#3237
Open
lawofcycles wants to merge 1 commit intoapache:mainfrom
Open
Fix DELETED manifest entry snapshot_id in OverwriteFiles#3237lawofcycles wants to merge 1 commit intoapache:mainfrom
lawofcycles wants to merge 1 commit intoapache:mainfrom
Conversation
When _OverwriteFiles._deleted_entries() creates DELETED manifest entries, it now sets snapshot_id to the current (deleting) snapshot's ID instead of retaining the original INSERT snapshot's ID. This aligns with the Iceberg spec which states that for DELETED entries, snapshot_id should be the snapshot in which the file was deleted. The existing _DeleteFiles._compute_deletes() already handled this correctly. Signed-off-by: Sotaro Hikita <bering1814@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
When _OverwriteFiles._deleted_entries() creates DELETED manifest entries, it now sets snapshot_id to the current (deleting) snapshot's ID instead of retaining the original INSERT snapshot's ID.
Closes #3236
According to the Iceberg spec (Manifest Entry Fields),
snapshot_idfor a DELETED entry (status=2) should be the snapshot ID in which the file was deleted. However,_OverwriteFiles._deleted_entries()was copying the original entry'ssnapshot_id(from the INSERT snapshot) into the new DELETED entry.This caused downstream consumers that filter manifest entries by
snapshot_id(e.g. Iceberg Java'sIncrementalChangelogScan) to silently miss DELETED files, breaking CDC pipelines.Are these changes tested?
Added
test_manifest_entry_snapshot_id_after_partial_deletesintests/integration/test_deletes.py.Are there any user-facing changes?
N/A