Skip to content

Commit

Permalink
Feature duckdb#1272: Window Distinct Merging
Browse files Browse the repository at this point in the history
PR Feedback: Use all threads for all merges.
  • Loading branch information
hawkfish committed Aug 7, 2024
1 parent 1872a52 commit 1d831a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/execution/window_segment_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,12 +1595,12 @@ bool WindowDistinctAggregatorGlobalState::TryPrepareNextStage(WindowDistinctAggr
return false;
}
global_sort->PrepareMergePhase();
total_tasks = global_sort->sorted_blocks.size() / 2;
if (!total_tasks) {
if (!(global_sort->sorted_blocks.size() / 2)) {
break;
}
global_sort->InitializeMergeRound();
lstate.stage = stage = PartitionSortStage::MERGE;
total_tasks = locals;
tasks_assigned = 1;
tasks_completed = 0;
return true;
Expand All @@ -1614,11 +1614,12 @@ bool WindowDistinctAggregatorGlobalState::TryPrepareNextStage(WindowDistinctAggr
}
global_sort->CompleteMergeRound(true);
total_tasks = global_sort->sorted_blocks.size() / 2;
if (!total_tasks) {
if (!(global_sort->sorted_blocks.size() / 2)) {
break;
}
global_sort->InitializeMergeRound();
lstate.stage = PartitionSortStage::MERGE;
total_tasks = locals;
tasks_assigned = 1;
tasks_completed = 0;
return true;
Expand Down

0 comments on commit 1d831a0

Please sign in to comment.