This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 22c68956881 branch-3.0: [fix](Nereids) insert into with cte cannot be
explained (#46384) (#46504)
22c68956881 is described below
commit 22c689568818a7adc0ae5d79cbb7665543bd8ada
Author: morrySnow <[email protected]>
AuthorDate: Tue Jan 7 17:38:23 2025 +0800
branch-3.0: [fix](Nereids) insert into with cte cannot be explained
(#46384) (#46504)
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 9048f6c3a03..7b1121e5d14 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
@@ -314,7 +314,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 a0ff8c3ba7d..8d041e4dd84 100644
--- a/regression-test/suites/nereids_p0/explain/explain_dml.groovy
+++ b/regression-test/suites/nereids_p0/explain/explain_dml.groovy
@@ -119,4 +119,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: [email protected]
For additional commands, e-mail: [email protected]