JingsongLi commented on PR #8115:
URL: https://github.com/apache/paimon/pull/8115#issuecomment-4621217884

   Thanks for adding multi-clause fall-through support. The overall evaluation 
order looks aligned with `MERGE INTO` semantics: clauses are evaluated in 
order, the first matching clause wins, and `NULL` conditions fall through.
   
   One SQL-compatibility gap still needs to be handled before merging: a 
non-last clause without a condition should be rejected. Spark SQL rejects 
`MERGE INTO` statements where any non-last `WHEN MATCHED` / `WHEN NOT MATCHED` 
clause omits its condition; only the last clause of each clause kind may be 
unconditional.
   
   This PR currently accepts the equivalent Python API shape, and the 
implementation will silently make later clauses unreachable because the 
unconditional clause consumes all remaining rows. For example:
   
   ```python
   when_matched=[
       WhenMatched(update="*"),
       WhenMatched(update={"age": "s.age"}, condition="s.age > 10"),
   ]
   ```
   
   The second clause can never run, while the corresponding SQL form would fail 
during parsing/analysis. Could we add validation in `_prepare` for both 
`when_matched` and `when_not_matched`, plus negative tests for unconditional 
non-last clauses? That would make the Python API behavior match the supported 
`MERGE INTO` syntax more closely.


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