Skip to content

Commit c9cccc3

Browse files
committed
cargo fmt
1 parent 799bb74 commit c9cccc3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/query/service/src/pipelines/processors/transforms/aggregator/new_aggregate/new_transform_final_aggregate.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ impl NewTransformFinalAggregate {
147147
}
148148

149149
impl NewTransformFinalAggregate {
150+
#[inline]
151+
fn should_check_spill(need_check_spill: bool, spilled_occurred: bool) -> bool {
152+
// Once a task has spilled in the current round, `finish()` will always
153+
// flush the remaining hash table into spilled tasks. Re-checking spill
154+
// on the rest of the input in the same round only creates redundant
155+
// intermediate spill transitions.
156+
need_check_spill && !spilled_occurred
157+
}
158+
150159
fn next_task_id(&self) -> u64 {
151160
self.next_task_id.fetch_add(1, Ordering::Relaxed)
152161
}
@@ -234,6 +243,8 @@ impl NewTransformFinalAggregate {
234243
}
235244

236245
fn handle_meta(&mut self, meta: AggregateMeta, need_check_spill: bool) -> Result<()> {
246+
let need_check_spill = Self::should_check_spill(need_check_spill, self.spilled_occurred);
247+
237248
match meta {
238249
AggregateMeta::Serialized(payload) => {
239250
self.handle_serialized(payload)?;

0 commit comments

Comments
 (0)