fix: use OpReplace instead of OpOverwrite in ReplaceDataFiles and ReplaceFiles#867
Open
Bahtya wants to merge 3 commits intoapache:mainfrom
Open
fix: use OpReplace instead of OpOverwrite in ReplaceDataFiles and ReplaceFiles#867Bahtya wants to merge 3 commits intoapache:mainfrom
Bahtya wants to merge 3 commits intoapache:mainfrom
Conversation
…laceFiles Per the Iceberg spec, REPLACE is the correct operation when data is reorganized (e.g., compaction) without changing content. ReplaceDataFiles, ReplaceDataFilesWithDataFiles, and ReplaceFiles all reorganize data files, so they should use OpReplace rather than OpOverwrite. Removes the TODO comment that acknowledged this was incorrect. Fixes apache#841
Remove extra blank line between doc comment and function declaration.
…ests Update TestReplaceDataFiles and TestReplaceDataFilesWithDataFiles to expect OpReplace instead of OpOverwrite in snapshot summaries, matching the production code change.
laskoviymishka
approved these changes
Apr 9, 2026
Contributor
laskoviymishka
left a comment
There was a problem hiding this comment.
Thnx for contribution!
Looks good to me.
Author
|
Hi team, just wanted to follow up on this PR. It has been reviewed and approved by @laskoviymishka, and all CI checks are passing. Would appreciate if a maintainer could take a look and merge when ready. Thank you! |
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.
Summary
Fixes #841 (parent #832)
Changes
ReplaceDataFiles,ReplaceDataFilesWithDataFiles, andReplaceFilesto useOpReplaceinstead ofOpOverwritewhen creating snapshot updates.Problem
Per the Iceberg spec,
REPLACEis the correct operation when data content is equivalent but reorganized into different files (e.g., compaction). The three replace methods were unconditionally usingOpOverwritedespite a TODO comment acknowledging this was incorrect.Changes
table/transaction.go: ChangedOpOverwrite→OpReplacein three locations:ReplaceDataFiles(line ~418)ReplaceDataFilesWithDataFiles(line ~713)ReplaceFiles(line ~826)ReplaceDataFilesthat acknowledged the incorrect operation typetable/replace_files_test.go: UpdatedTestReplaceFiles_DataAndDeleteFilesto assertOpReplaceTesting
All existing tests pass: