yihua opened a new pull request, #20888: URL: https://github.com/apache/hudi/pull/20888
### Describe the issue this Pull Request addresses closes #20887 A MERGE INTO with a `WHEN MATCHED ... THEN DELETE` clause on a merge-on-read table without a record key that has an ordering field fails in the append handle with `NoSuchElementException: No value present in Option`. ### Summary and Changelog `HoodieCreateRecordUtils` built such a record with its delete flag fixed to false, so the append handle took a record that the clauses delete as an update with no value. For a MERGE INTO write, a record that is not flagged as a delete in its data now leaves the flag unset, so the clauses decide on write; other writes keep the flag they had. A new test in `TestMergeIntoTableWithNonRecordKeyField` runs a delete next to an update clause and a delete-only statement on COW and MOR tables (the MOR case fails without the fix). ### Impact A MERGE INTO with a delete clause on a merge-on-read table without a record key that has ordering fields now deletes the matched records instead of failing. ### Risk Level low. The change only applies to MERGE INTO writes of records that are not already flagged as deletes. ### 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]
