cshuo opened a new pull request, #20288:
URL: https://github.com/apache/hudi/pull/20288

   ### Describe the issue this Pull Request addresses
   
   Closes https://github.com/apache/hudi/issues/20287
   
   Flink precombine correctly selects an event-time delete, but the subsequent 
`HoodieEmptyRecord.newInstance(HoodieKey)` call drops its operation and resets 
ordering to the natural-order sentinel. For example, after persisting a row at 
`ts=100`, a batch containing INSERT(50) and DELETE(60) incorrectly removes that 
row. Preserving the delete metadata keeps the newer persisted row and still 
allows DELETE(110) to remove it.
   
   ### Summary and Changelog
   
   - Copy `operation`, `orderingVal`, and record type through the existing 
`HoodieEmptyRecord` constructor when replacing the key.
   - Add key-copy coverage for DELETE, UPDATE_BEFORE, typed ordering values, 
and natural-order deletes.
   - Add independent grouped/sorted Flink deduplication assertions, including 
an obsolete reinsert after a newer delete.
   - Add two-checkpoint COW/MOR write/read coverage with precombine enabled and 
disabled, using the existing test harness and complete snapshot expectations.
   
   Validated commit: `8880e2e1b47`.
   
   ### Impact
   
   Stale event-time deletes no longer remove newer records because of metadata 
loss during precombine, and older inserts cannot supersede a newer delete for 
the same reason. The production change is in a shared record class; 
natural-order deletes keep their existing semantics. There are no public API, 
configuration, or storage-format changes.
   
   ### Risk Level
   
   Low. The production change is a one-line constructor substitution that 
preserves metadata already present on the original record. Focused tests cover 
explicit and natural-order deletes, shared buffered-record behavior, Flink 
grouped/sorted reduction, and COW/MOR persistence.
   
   An independent source export of the final commit passed **29 tests**, with 
zero failures, errors, or skips, on Java 11.0.27 and Flink 1.20.1:
   
   ```bash
   mvn -Pflink1.20 -pl hudi-flink-datasource/hudi-flink -am 
'-Dtest=TestHoodieEmptyRecord,TestBufferedRecords,TestBufferedRecordMergerFactory,TestFlinkWriteHelper,TestWriteCopyOnWrite#testDeduplicationPreservesEventTimeDeleteOrdering+testUpsertWithDelete,TestWriteMergeOnRead#testDeduplicationPreservesEventTimeDeleteOrdering+testUpsertWithDelete'
 -Dsurefire.failIfNoSpecifiedTests=false -DskipITs -DskipSparkTests 
-DskipScalaTests test
   ```
   
   Full Spark/Java engine suites and other Flink versions were not run.
   
   ### Documentation Update
   
   none
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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