yihua opened a new pull request, #20893: URL: https://github.com/apache/hudi/pull/20893
### Describe the issue this Pull Request addresses closes #20892 A MERGE INTO on a merge-on-read table that writes partial updates can null out the fields of an updated record when another source record of the same write is packed into a small base file of that file group. ### Summary and Changelog The merge that packs inserts into a small base file takes every record of its file group, and treats the partial update of a record the file holds as the full record. When the write carries partial updates and the index cannot index log files, `SparkUpsertDeltaCommitPartitioner#getSmallFiles` now leaves out the small files that take an update in this write, so their partial updates stay in the log; small files without updates still take inserts. The Java client's `JavaUpsertPartitioner` applies the same rule for merge-on-read tables, since `BaseJavaDeltaCommitActionExecutor` also merges a small file that takes inserts. New tests: `TestPartialUpdateForMergeInto` (partitioned and non-partitioned MOR, with and without a not-matched insert clause; without the fix the updated row reads back as all nulls) and partitioner tests in `TestUpsertPartitioner` and `TestJavaCopyOnWriteActionExecutor` checking that only the updated small file is left out. ### Impact MERGE INTO partial updates on MOR tables no longer corrupt the updated records. A small file that takes a partial update in a write no longer takes inserts in that write; other small files are packed as before. ### Risk Level low. Only writes with partial updates on an index that cannot index log files take the new path, and they only skip the small files they update. ### Documentation Update none ### Contributor's checklist - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute) - [ ] Enough context is provided in the sections above - [ ] Adequate tests were added if applicable -- 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]
