This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new abbf75e9fe1 branch-2.1: [fix](Nereids) insert into with cte cannot be 
explained (#46384) (#46501)
abbf75e9fe1 is described below

commit abbf75e9fe10c6f492d5cfc8ef3837dbf24b7b07
Author: morrySnow <zhangwen...@selectdb.com>
AuthorDate: Tue Jan 7 13:44:32 2025 +0800

    branch-2.1: [fix](Nereids) insert into with cte cannot be explained 
(#46384) (#46501)
    
    pick from master #46384
---
 .../nereids/trees/plans/commands/insert/InsertIntoTableCommand.java | 6 +++++-
 regression-test/suites/nereids_p0/explain/explain_dml.groovy        | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
index ba73f999327..73455da61d2 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
@@ -321,7 +321,11 @@ public class InsertIntoTableCommand extends Command 
implements ForwardWithSync,
 
     @Override
     public Plan getExplainPlan(ConnectContext ctx) {
-        return InsertUtils.getPlanForExplain(ctx, this.logicalQuery);
+        Plan plan = InsertUtils.getPlanForExplain(ctx, this.logicalQuery);
+        if (cte.isPresent()) {
+            plan = cte.get().withChildren(plan);
+        }
+        return plan;
     }
 
     @Override
diff --git a/regression-test/suites/nereids_p0/explain/explain_dml.groovy 
b/regression-test/suites/nereids_p0/explain/explain_dml.groovy
index a007185ce63..781c55c70e1 100644
--- a/regression-test/suites/nereids_p0/explain/explain_dml.groovy
+++ b/regression-test/suites/nereids_p0/explain/explain_dml.groovy
@@ -121,4 +121,6 @@ suite("explain_dml") {
         sql "update duptbl set v1=1 where k1=1;"
         exception "Only unique table could be updated."
     }
+
+    sql """explain with tmp as (select 1, 2, '3', 4.0, '2000-01-01') insert 
into epldel1 select * from tmp"""
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to