diff --git a/src/executor/operator/physical_explain.cpp b/src/executor/operator/physical_explain.cpp index 44142e914c..cd4a5d6b06 100644 --- a/src/executor/operator/physical_explain.cpp +++ b/src/executor/operator/physical_explain.cpp @@ -32,6 +32,7 @@ import status; import infinity_exception; import logical_type; import logger; +import plan_fragment; namespace infinity { @@ -172,4 +173,6 @@ bool PhysicalExplain::Execute(QueryContext *, OperatorState *operator_state) { return true; } +void PhysicalExplain::SetPlanFragment(PlanFragment *plan_fragment_ptr) { plan_fragment_ptr_ = plan_fragment_ptr; } + } // namespace infinity diff --git a/src/executor/operator/physical_explain.cppm b/src/executor/operator/physical_explain.cppm index c8a40905e5..f44849234f 100644 --- a/src/executor/operator/physical_explain.cppm +++ b/src/executor/operator/physical_explain.cppm @@ -28,6 +28,7 @@ import internal_types; import explain_statement; import data_type; import logger; +import plan_fragment; namespace infinity { @@ -43,7 +44,7 @@ public: ~PhysicalExplain() override = default; - void Init(QueryContext* query_context) override; + void Init(QueryContext *query_context) override; bool Execute(QueryContext *query_context, OperatorState *operator_state) final; @@ -51,6 +52,8 @@ public: void SetExplainTaskText(SharedPtr>> text) { task_texts_ = std::move(text); } + void SetPlanFragment(PlanFragment *plan_fragment_ptr); + inline SharedPtr> GetOutputNames() const final { return output_names_; } inline SharedPtr>> GetOutputTypes() const final { return output_types_; } @@ -66,6 +69,8 @@ private: SharedPtr> output_names_{}; SharedPtr>> output_types_{}; + + PlanFragment *plan_fragment_ptr_; }; } // namespace infinity diff --git a/src/scheduler/fragment_context.cpp b/src/scheduler/fragment_context.cpp index a936a5013a..bafc8f4caf 100644 --- a/src/scheduler/fragment_context.cpp +++ b/src/scheduler/fragment_context.cpp @@ -633,6 +633,7 @@ void FragmentContext::BuildTask(QueryContext *query_context, FragmentContext *pa if (explain_op->explain_type() == ExplainType::kPipeline or explain_op->explain_type() == ExplainType::kAnalyze) { CollectTasks(result, plan_fragment_ptr->Children()[0].get()); explain_op->SetExplainTaskText(MakeShared>>(result)); + explain_op->SetPlanFragment(plan_fragment_ptr->Children()[0].get()); break; } } @@ -1114,8 +1115,8 @@ void FragmentContext::MakeSinkState(i64 parallel_count) { } case PhysicalOperatorType::kLimit: { // if (fragment_type_ != FragmentType::kParallelStream) { - // String error_message = fmt::format("{} should in parallel stream fragment", PhysicalOperatorToString(last_operator->operator_type())); - // UnrecoverableError(error_message); + // String error_message = fmt::format("{} should in parallel stream fragment", + // PhysicalOperatorToString(last_operator->operator_type())); UnrecoverableError(error_message); // } if ((i64)tasks_.size() != parallel_count) {