vinishjail97 opened a new pull request, #816:
URL: https://github.com/apache/incubator-xtable/pull/816

   ## Problem
   
   When XTable processes multiple `INSERT_OVERWRITE` `replacecommit` instants 
in a single batch (e.g., commit A replaces the initial file groups, then commit 
B replaces A's file groups on the same partition), 
`getUpdatesToPartitionForReplaceCommit` uses 
`getReplacedFileGroupsBeforeOrOn(A.timestamp)` to find replaced file groups. 
This **excludes** A's own file groups because they were replaced by B (and B's 
timestamp > A's), and `getAllFileGroups` also excludes them (globally marked 
replaced). The result: replacecommit A emits **0 adds**, causing downstream 
format sync failures.
   
   ## Fix
   
   Change `getReplacedFileGroupsBeforeOrOn` → `getAllReplacedFileGroups` in the 
replace commit handler. This is consistent with how `getUpdatesToPartition` 
already handles regular commits (where all file groups across the timeline are 
considered). The `newFileIds` and `replacedFileIds` sets derived from each 
commit's write stats already ensure only the correct files are emitted as adds 
or removes for that specific commit.
   
   ## Tests
   
   - Added `insertOverwrite()` helper to `TestSparkHudiTable`
   - Added `testMultipleInsertOverwriteOnSamePartitions` integration test in 
`ITHudiConversionSource` that reproduces the bug and validates the fix
   - New test fails without the fix (replacecommit A has `expected: 
<[...parquet]> but was: <[]>`) and passes with it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to