morrySnow commented on code in PR #36150:
URL: https://github.com/apache/doris/pull/36150#discussion_r1635907948


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java:
##########
@@ -94,8 +94,8 @@ public UpdateCommand(List<String> nameParts, @Nullable String 
tableAlias, List<E
     @Override
     public void run(ConnectContext ctx, StmtExecutor executor) throws 
Exception {
         // NOTE: update command is executed as insert command, so txn insert 
can support it
-        new InsertIntoTableCommand(completeQueryPlan(ctx, logicalQuery), 
Optional.empty(), Optional.empty()).run(ctx,
-                executor);
+        new InsertIntoTableCommand(completeQueryPlan(ctx, logicalQuery), 
Optional.empty(), Optional.empty(), cte).run(
+                ctx, executor);

Review Comment:
   same as delete



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertOverwriteTableCommand.java:
##########
@@ -112,6 +116,9 @@ public void run(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
                     + " But current table type is " + targetTableIf.getType());
         }
         this.logicalQuery = (LogicalPlan) 
InsertUtils.normalizePlan(logicalQuery, targetTableIf);
+        if (cte.isPresent()) {
+            this.logicalQuery = ((LogicalPlan) 
cte.get().withChildren(logicalQuery));
+        }

Review Comment:
   add cte node as sink's child to avoid remove it in L150



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromUsingCommand.java:
##########
@@ -77,8 +77,8 @@ public void run(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
                     + ctx.getSessionVariable().printDebugModeVariables());
         }
         // NOTE: delete from using command is executed as insert command, so 
txn insert can support it
-        new InsertIntoTableCommand(completeQueryPlan(ctx, logicalQuery), 
Optional.empty(), Optional.empty()).run(ctx,
-                executor);
+        new InsertIntoTableCommand(completeQueryPlan(ctx, logicalQuery), 
Optional.empty(), Optional.empty(), cte).run(
+                ctx, executor);

Review Comment:
   `compeleteQueryPlan` aready process cte, so we should
   either use `Optional.empty()` here,
   or do not process cte in `compeleteQueryPlan`



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertOverwriteTableCommand.java:
##########
@@ -182,7 +192,7 @@ public void run(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
     private void runInsertCommand(LogicalPlan logicalQuery, 
InsertCommandContext insertCtx,
                                   ConnectContext ctx, StmtExecutor executor) 
throws Exception {
         InsertIntoTableCommand insertCommand = new 
InsertIntoTableCommand(logicalQuery, labelName,
-                Optional.of(insertCtx));
+                Optional.of(insertCtx), cte);

Review Comment:
   after we make cte as sink's child, cte should be replaced by Optional.empty()



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