@@ -197,10 +197,7 @@ impl Interpreter for ExplainInterpreter {
197
197
schema. clone ( ) ,
198
198
metadata. clone ( ) ,
199
199
) ?;
200
- let mut plan = interpreter. build_physical_plan ( & mutation, None ) . await ?;
201
- if let PhysicalPlan :: CommitSink ( commit) = & plan {
202
- plan = commit. input . as_ref ( ) . clone ( ) ;
203
- }
200
+ let plan = interpreter. build_physical_plan ( & mutation, None ) . await ?;
204
201
self . explain_analyze ( plan, metadata, true ) . await ?
205
202
}
206
203
_ => Err ( ErrorCode :: Unimplemented (
@@ -442,13 +439,18 @@ impl ExplainInterpreter {
442
439
metadata : & MetadataRef ,
443
440
ignore_result : bool ,
444
441
) -> Result < Vec < DataBlock > > {
445
- let build_res = build_query_pipeline ( & self . ctx , & [ ] , & plan, ignore_result) . await ?;
442
+ let plan = if let PhysicalPlan :: CommitSink ( commit) = & plan {
443
+ commit. input . as_ref ( )
444
+ } else {
445
+ & plan
446
+ } ;
447
+ let build_res = build_query_pipeline ( & self . ctx , & [ ] , plan, ignore_result) . await ?;
446
448
447
449
// Drain the data
448
450
let query_profiles = self . execute_and_get_profiles ( build_res) ?;
449
451
450
452
let result = if self . partial {
451
- format_partial_tree ( & plan, metadata, & query_profiles) ?. format_pretty ( ) ?
453
+ format_partial_tree ( plan, metadata, & query_profiles) ?. format_pretty ( ) ?
452
454
} else {
453
455
plan. format ( metadata. clone ( ) , query_profiles. clone ( ) ) ?
454
456
. format_pretty ( ) ?
0 commit comments