Skip to content

fix(executor): fix broken profile graph for union all #14107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/query/pipeline/core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct Pipeline {
on_finished: Option<FinishedCallback>,
lock_guards: Vec<LockGuard>,

pub plans_scope: Vec<PlanScope>,
plans_scope: Vec<PlanScope>,
scope_size: Arc<AtomicUsize>,
}

Expand Down Expand Up @@ -154,6 +154,11 @@ impl Pipeline {
self
}

pub fn get_scopes(&self) -> Vec<PlanScope> {
let scope_size = self.scope_size.load(Ordering::SeqCst);
self.plans_scope[..scope_size].to_vec()
}

pub fn add_pipe(&mut self, mut pipe: Pipe) {
let (scope_idx, _) = self.scope_size.load(Ordering::SeqCst).overflowing_sub(1);

Expand Down Expand Up @@ -454,7 +459,7 @@ impl Pipeline {

if self.plans_scope.len() > scope_idx {
self.plans_scope[scope_idx] = scope;
self.plans_scope.shrink_to(scope_idx + 1);
self.plans_scope.truncate(scope_idx + 1);
return PlanScopeGuard::create(self.scope_size.clone(), scope_idx);
}

Expand Down
6 changes: 3 additions & 3 deletions src/query/service/src/pipelines/builders/builder_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl PipelineBuilder {
right_side_context,
self.enable_profiling,
self.proc_profs.clone(),
self.main_pipeline.plans_scope.clone(),
self.main_pipeline.get_scopes(),
);
right_side_builder.cte_state = self.cte_state.clone();
let mut right_res = right_side_builder.finalize(&range_join.right)?;
Expand Down Expand Up @@ -154,7 +154,7 @@ impl PipelineBuilder {
build_side_context,
self.enable_profiling,
self.proc_profs.clone(),
self.main_pipeline.plans_scope.clone(),
self.main_pipeline.get_scopes(),
);
build_side_builder.cte_state = self.cte_state.clone();
let mut build_res = build_side_builder.finalize(build)?;
Expand Down Expand Up @@ -317,7 +317,7 @@ impl PipelineBuilder {
left_side_ctx,
self.enable_profiling,
self.proc_profs.clone(),
self.main_pipeline.plans_scope.clone(),
self.main_pipeline.get_scopes(),
);
left_side_builder.cte_state = self.cte_state.clone();
let mut left_side_pipeline = left_side_builder.finalize(left_side)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ impl PipelineBuilder {
union_ctx,
self.enable_profiling,
self.proc_profs.clone(),
self.main_pipeline.plans_scope.clone(),
self.main_pipeline.get_scopes(),
);
pipeline_builder.cte_state = self.cte_state.clone();

let mut build_res = pipeline_builder.finalize(input)?;

assert!(build_res.main_pipeline.is_pulling_pipeline()?);
Expand Down