cshuo opened a new pull request, #20341: URL: https://github.com/apache/hudi/pull/20341
### Describe the issue this Pull Request addresses Closes https://github.com/apache/hudi/issues/20330. Spark and Avro record reconstruction discard non-empty delete payloads. In Spark, this bypasses engine-specific ordering conversion and breaks MOR inline delete-block serialization for string/decimal ordering fields. In the Avro log scanner, it allows an older insert to resurrect a delete when `DefaultHoodieRecordPayload.preCombine()` treats the discarded payload as an empty record. ### Summary and Changelog - Construct `HoodieEmptyRecord` only when the buffered record is both deleted and empty in Spark reconstruction and Avro final-record reconstruction. - Preserve the engine record for deletes with a payload. - Add Spark MOR write/read coverage for precombined deletes with string/decimal ordering on table versions 8 and 9, an Avro log-scanner regression for `insert50 → delete60 → insert55`, and reconstruction coverage for empty/non-empty Avro deletes. ### Impact Preserves event-time delete ordering through Spark writes and Avro log merging. No public API, configuration, or storage-format changes. ### Risk Level Low: two construction guards now follow the existing Flink behavior. Empty tombstones retain their current representation. Validation: 35 selected tests passed, including Spark MOR string/decimal deletes on table versions 8/9, the existing Spark/Avro MOR precombine test, Avro log scanning, and empty-record metadata preservation. Java Checkstyle and Scala style checks passed. Removing the two production changes makes all four new Spark cases fail with unsupported ordering-value serialization and the Avro scanner case fail because the record is no longer deleted. ### Documentation Update none ### Contributor's checklist - [ ] 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]
