@@ -512,14 +512,18 @@ impl GroupedHashAggregateStream {
512
512
} ;
513
513
514
514
// We don't support blocked emission in steaming aggregation mode
515
- let emit_tos_builder = if matches ! ( group_ordering, GroupOrdering :: None ) {
516
- let group_values_support_blocked_emission =
517
- group_values. supports_blocked_emission ( ) ;
518
- let accumulators_support_blocked_emission =
515
+ // TODO: I am not sure, if we should disable blocked mode if `accumulator`s are empty.
516
+ let group_states_ctx = if matches ! ( group_ordering, GroupOrdering :: None )
517
+ && !accumulators. is_empty ( )
518
+ {
519
+ let is_blocked_group_values = group_values. supports_blocked_emission ( ) ;
520
+ let is_blocked_accumulators =
519
521
accumulators. iter ( ) . all ( |a| a. supports_blocked_emission ( ) ) ;
522
+
523
+ // TODO: if the batch size is too small, maybe we should fallback to single block mode.
520
524
GroupStatesContext :: new (
521
- group_values_support_blocked_emission ,
522
- accumulators_support_blocked_emission ,
525
+ is_blocked_group_values ,
526
+ is_blocked_accumulators ,
523
527
batch_size,
524
528
)
525
529
} else {
@@ -546,7 +550,7 @@ impl GroupedHashAggregateStream {
546
550
spill_state,
547
551
group_values_soft_limit : agg. limit ,
548
552
skip_aggregation_probe,
549
- group_states_ctx : emit_tos_builder ,
553
+ group_states_ctx,
550
554
} )
551
555
}
552
556
}
@@ -1117,13 +1121,13 @@ pub struct GroupStatesContext {
1117
1121
1118
1122
impl GroupStatesContext {
1119
1123
pub fn new (
1120
- group_values_support_blocked_emission : bool ,
1121
- accumulators_support_blocked_emission : bool ,
1124
+ is_blocked_group_values : bool ,
1125
+ is_blocked_accumulators : bool ,
1122
1126
block_size : usize ,
1123
1127
) -> Self {
1124
1128
Self {
1125
- is_blocked_group_values : group_values_support_blocked_emission ,
1126
- is_blocked_accumulators : accumulators_support_blocked_emission ,
1129
+ is_blocked_group_values,
1130
+ is_blocked_accumulators,
1127
1131
block_size,
1128
1132
}
1129
1133
}
0 commit comments