YannByron commented on PR #9155: URL: https://github.com/apache/paimon/pull/9155#issuecomment-5249878538
@kerwin-zk Before settling on the fix, I think we should first agree on the semantics of the `ON`condition in `MERGE INTO`, since the whole patch hinges on it: does `ON` define the scope of the target rows the statement may touch, or is it purely the predicate that decides which target rows count as *matched*? Two readings, using your repro: 1. **`ON` scopes the merge.** `t.pt = 'p1'` restricts the statement to the `p1` rows; anything outside that scope is simply out of the statement's reach, so `WHEN NOT MATCHED BY SOURCE` should only consider `p1` rows. Under this reading the current pruning is correct and the `p2` rows should stay untouched. 2. **`ON` is only the matching predicate.** `WHEN NOT MATCHED BY SOURCE` is defined over *every* target row for which no source row satisfies the merge condition. The `p2` rows trivially qualify, so they must be updated — which is what this PR asserts. The two readings give opposite expected results for the same statement, so which one we consider correct determines whether this is a bug fix or a behavior change. -- 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]
