Skip to content

Commit

Permalink
branch-3.0: [fix](Nereids) insert into with cte cannot be explained (#…
Browse files Browse the repository at this point in the history
…46384) (#46504)

pick from master #46384
  • Loading branch information
morrySnow authored Jan 7, 2025
1 parent c9abf2c commit 22c6895
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,11 @@ public boolean isExternalTableSink() {

@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
Expand Down
2 changes: 2 additions & 0 deletions regression-test/suites/nereids_p0/explain/explain_dml.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
}

0 comments on commit 22c6895

Please sign in to comment.