linliu-code opened a new pull request, #19979:
URL: https://github.com/apache/hudi/pull/19979

   ### Describe the issue this Pull Request addresses
   
   closes #19978
   
   ### Summary and Changelog
   
   A SQL `MERGE INTO ... WHEN MATCHED THEN DELETE` now applies the delete 
unconditionally on MOR, as it already did on COW and as `DELETE FROM` already 
does on both table types. `HoodieAppendHandle` stamps the default ordering 
value on a delete when the write comes from a Spark SQL MERGE INTO statement, 
which makes the reader treat it as a commit time ordered delete. Ingestion 
paths keep event time semantics: the gate is an overridable method, and 
`FileGroupReaderBasedAppendHandle` returns false from it, because log 
compaction inherits the write config of the client that scheduled it and 
rewrites pre-existing log records rather than the statement's own. The config 
key moves to `HoodieWriteConfig` so the Scala `ConfigProperty` and the Java 
read share one declaration.
   
   ### Impact
   
   User facing on a stable SQL path: on a MOR table ordered by event time, a 
MERGE INTO delete with a stale ordering value now removes the row where it 
previously left it in place. A MERGE INTO tombstone also no longer holds off a 
later lower ordering value upsert on the same key, matching COW, where the 
delete removes the row from the base file and a later upsert reinserts it.
   
   ### Risk Level
   
   medium
   
   `TestMergeModeEventTimeOrdering` was fenced to MOR; the fence is removed so 
COW and MOR assert the same behaviour (20 cases, 5 COW and 5 MOR merge cases 
among them). Reverting the gate fails exactly the 5 MOR merge cases on the 
stale row, and removing the log compaction override fails exactly the new log 
compaction test. `TestMORDataSource#testPreCombineFieldForReadMOR`, which 
asserts an ingestion delete with a stale ordering value does not delete, stays 
green and fails if the gate is widened to all MOR deletes.
   
   ### 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
   


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