Skip to content

Commit

Permalink
[fix](Nereids) insert into with cte cannot be explained
Browse files Browse the repository at this point in the history
  • Loading branch information
morrySnow committed Jan 6, 2025
1 parent c983e83 commit c65f499
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 @@ -428,7 +428,11 @@ public Plan getExplainPlan(ConnectContext ctx) {
Optional<CascadesContext> analyzeContext = Optional.of(
CascadesContext.initContext(ctx.getStatementContext(), originLogicalQuery, PhysicalProperties.ANY)
);
return InsertUtils.getPlanForExplain(ctx, analyzeContext, getLogicalQuery());
Plan plan = InsertUtils.getPlanForExplain(ctx, analyzeContext, getLogicalQuery());
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 c65f499

Please sign in to comment.