fix: equality deletes written to the wrong partition - #91
Merged
Merged
Conversation
Iceberg scopes an equality delete to its own partition, but the writer placed each delete by its row payload. A key-only delete (REPLICA IDENTITY DEFAULT, partition column outside the key) carries NULL for the partition column, and an UPDATE's new values can name another partition than the old row's. Both deletes missed the row they meant to remove: the deleted row stayed, or the moved row was left in both partitions. Equality deletes now go to the partition the FileIndex has their key in, where the row lives, falling back to the payload for unindexed keys. The DST oracle also checks that every row is stored in the partition its values compute to: a misplaced row reads back on a full scan, but a query pruning on the partition column skips it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
This fixes
delete_under_default_replica_identity_reaches_the_rows_partitionandupdate_moving_a_row_between_partitions_leaves_no_copy.Iceberg scopes an equality delete to its own partition. The writer placed each delete by its row payload, which can't say where the row lives:
REPLICA IDENTITY DEFAULT, partition column outside the key): the delete carries NULL for the partition column, lands in the NULL partition, and the deleted row stays in Iceberg.The fix is to put equality deletes (a Delete's, and the delete half of an Update) in the partition the FileIndex has their key in. Unindexed keys fall back to the payload as before.