Skip to content

Commit

Permalink
fix(executor): fix broken query profiling graph (databendlabs#14183)
Browse files Browse the repository at this point in the history
* fix(executor): fix broken query profiling graph

* fix(executor): fix broken query profiling graph
  • Loading branch information
zhang2014 authored Dec 28, 2023
1 parent fd372c4 commit 5ed0ad1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/query/service/src/pipelines/pipeline_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use databend_common_expression::DataField;
use databend_common_expression::FunctionContext;
use databend_common_pipeline_core::Pipeline;
use databend_common_pipeline_core::PlanScope;
use databend_common_pipeline_core::PlanScopeGuard;
use databend_common_profile::SharedProcessorProfiles;
use databend_common_settings::Settings;
use databend_common_sql::executor::PhysicalPlan;
Expand Down Expand Up @@ -101,9 +102,18 @@ impl PipelineBuilder {
})
}

pub(crate) fn add_plan_scope(&mut self, plan: &PhysicalPlan) -> Option<PlanScopeGuard> {
match plan {
PhysicalPlan::EvalScalar(v) if v.exprs.is_empty() => None,
_ => {
let scope = PlanScope::create(plan.get_id(), plan.name());
Some(self.main_pipeline.add_plan_scope(scope))
}
}
}

pub(crate) fn build_pipeline(&mut self, plan: &PhysicalPlan) -> Result<()> {
let scope = PlanScope::create(plan.get_id(), plan.name());
let _guard = self.main_pipeline.add_plan_scope(scope);
let _guard = self.add_plan_scope(plan);
match plan {
PhysicalPlan::TableScan(scan) => self.build_table_scan(scan),
PhysicalPlan::CteScan(scan) => self.build_cte_scan(scan),
Expand Down

0 comments on commit 5ed0ad1

Please sign in to comment.