morningman commented on code in PR #69488:
URL: https://github.com/apache/doris/pull/69488#discussion_r4430911846


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/RowLevelDmlCommand.java:
##########
@@ -154,7 +154,7 @@ public void run(ConnectContext ctx, StmtExecutor 
stmtExecutor) throws Exception
     public Plan getExplainPlan(ConnectContext ctx) {

Review Comment:
   Keeping this as is. A MERGE resolves `DEFAULT(column)` in its ON condition 
against the writer schema it pins, whatever its WHEN branches, and so does 
branch-4.2, which this PR ports. There, `IcebergMergeCommand` installs the 
write schema context for every MERGE, delete-only ones included, both when it 
runs and for EXPLAIN (`ExplainCommand` installs it again from the merge sink), 
and `RewriteDefaultExpression` resolves a target column from it. So on 
branch-4.2 too, `MERGE ... ON t.id = s.id AND t.c = DEFAULT(t.c) WHEN MATCHED 
THEN DELETE` deletes the matched rows whose `c` is 35. Master evaluates 
`DEFAULT(t.c)` to NULL there and deletes nothing.
   
   To be precise about the DELETE thread 
(https://github.com/apache/doris/pull/69488#discussion_r4409014234): the line 
follows branch-4.2 and depends on the kind of statement. branch-4.2 gives a 
DELETE no write schema context, so `DEFAULT(c)` fails there, and gives every 
MERGE one. "Writes no row values" explains why the DELETE has none. It is not a 
test applied to each MERGE. Rejecting a delete-only MERGE would break, after an 
upgrade, a statement that runs on branch-4.1 and branch-4.2. It would also make 
the same ON condition fail or resolve depending on whether the MERGE has an 
UPDATE or INSERT branch, although the condition selects the same rows to delete 
either way. The description now states that a MERGE resolves it whatever its 
WHEN branches, also when they all delete.
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to