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

   ### Describe the issue this Pull Request addresses
   
   closes #20829
   
   Spark parses `WHEN NOT MATCHED BY SOURCE` since 3.4, but neither the Spark 
plan utils nor `MergeIntoHoodieTableCommand` read those actions, so a `MERGE 
INTO` on a Hudi table with the clause runs as if it were not there and the 
target rows it should delete or update stay unchanged.
   
   ### Summary and Changelog
   
   `HoodieCatalystPlansUtils` gets `hasNotMatchedBySourceActions`, implemented 
for each Spark version (always false on Spark 3.3), and 
`ResolveImplementations` fails the analysis with "WHEN NOT MATCHED BY SOURCE 
clause is not supported in MERGE INTO statement on a Hudi table" when a 
`MergeIntoTable` on a Hudi table carries such actions. Applying the clause 
needs the target rows that no source row matches, which the command does not 
read for a table with a record key, so the clause stays unsupported for now.
   
   The new test runs the clause with `DELETE` and with `UPDATE`, checks the 
error, and checks the table is unchanged. On master both statements succeed and 
change nothing.
   
   ### Impact
   
   A statement with `WHEN NOT MATCHED BY SOURCE` on a Hudi table now fails at 
analysis instead of silently ignoring the clause.
   
   ### Risk Level
   
   low
   
   ### 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]

Reply via email to