Skip to content

Commit f60f9e2

Browse files
committed
make EmitTo::NextBlock simpler.
1 parent 808e8d7 commit f60f9e2

11 files changed

Lines changed: 42 additions & 79 deletions

File tree

datafusion/expr-common/src/groups_accumulator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub enum EmitTo {
3636
/// Emit next block in the blocked managed groups
3737
///
3838
/// Similar as `Emit::All`, will also clear all existing group indexes
39-
NextBlock(bool),
39+
NextBlock,
4040
}
4141

4242
impl EmitTo {
@@ -75,7 +75,7 @@ impl EmitTo {
7575
std::mem::swap(v, &mut t);
7676
t
7777
}
78-
Self::NextBlock(_) => unreachable!("don't support take block in take_needed"),
78+
Self::NextBlock => unreachable!("don't support take block in take_needed"),
7979
}
8080
}
8181

@@ -85,7 +85,7 @@ impl EmitTo {
8585
///
8686
fn take_needed_block<T>(&self, blocks: &mut VecDeque<Vec<T>>) -> Vec<T> {
8787
assert!(
88-
matches!(self, Self::NextBlock(_)),
88+
matches!(self, Self::NextBlock),
8989
"only support take block in take_needed_block"
9090
);
9191
blocks

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/accumulate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl SeenValues for FlatSeenValues {
303303
}
304304
first_n_null
305305
}
306-
EmitTo::NextBlock(_) => {
306+
EmitTo::NextBlock => {
307307
unreachable!("not support block emit in flat seen values")
308308
}
309309
};
@@ -415,7 +415,7 @@ impl SeenValues for BlockedSeenValues {
415415
}
416416

417417
fn emit(&mut self, emit_to: EmitTo) -> NullBuffer {
418-
assert!(matches!(emit_to, EmitTo::NextBlock(_)));
418+
assert!(matches!(emit_to, EmitTo::NextBlock));
419419

420420
let mut block = self
421421
.blocked_builders
@@ -542,7 +542,7 @@ impl NullStateAdapter {
542542
let mut return_builder = BooleanBufferBuilder::new(0);
543543
let num_blocks = null_state.seen_values.blocked_builders.len();
544544
for _ in 0..num_blocks {
545-
let blocked_nulls = null_state.build(EmitTo::NextBlock(true));
545+
let blocked_nulls = null_state.build(EmitTo::NextBlock);
546546
for bit in blocked_nulls.inner().iter() {
547547
return_builder.append(bit);
548548
}

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/bool_op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ where
118118
}
119119
first_n
120120
}
121-
EmitTo::NextBlock(_) => {
121+
EmitTo::NextBlock => {
122122
unreachable!("this accumulator still not support blocked groups")
123123
}
124124
};

datafusion/functions-aggregate/src/correlation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl GroupsAccumulator for CorrelationGroupsAccumulator {
448448
let n = match emit_to {
449449
EmitTo::All => self.count.len(),
450450
EmitTo::First(n) => n,
451-
EmitTo::NextBlock(_) => {
451+
EmitTo::NextBlock => {
452452
unreachable!("this accumulator still not support blocked groups")
453453
}
454454
};
@@ -504,7 +504,7 @@ impl GroupsAccumulator for CorrelationGroupsAccumulator {
504504
let n = match emit_to {
505505
EmitTo::All => self.count.len(),
506506
EmitTo::First(n) => n,
507-
EmitTo::NextBlock(_) => {
507+
EmitTo::NextBlock => {
508508
unreachable!("this accumulator still not support blocked groups")
509509
}
510510
};

datafusion/functions-aggregate/src/first_last.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ where
404404
self.size_of_orderings -=
405405
result.iter().map(ScalarValue::size_of_vec).sum::<usize>()
406406
}
407-
EmitTo::NextBlock(_) => {
407+
EmitTo::NextBlock => {
408408
unreachable!("this accumulator still not support blocked groups")
409409
}
410410
}
@@ -431,7 +431,7 @@ where
431431
}
432432
first_n
433433
}
434-
EmitTo::NextBlock(_) => {
434+
EmitTo::NextBlock => {
435435
unreachable!("this group values still not support blocked groups")
436436
}
437437
}

datafusion/functions-aggregate/src/min_max/min_max_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ impl MinMaxBytesState {
511511
self.total_data_bytes -= first_data_capacity;
512512
(first_data_capacity, first_min_maxes)
513513
}
514-
EmitTo::NextBlock(_) => {
514+
EmitTo::NextBlock => {
515515
unreachable!("this accumulator still not support blocked groups")
516516
}
517517
}

datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ impl<const STREAMING: bool> GroupValues for GroupValuesColumn<STREAMING> {
11541154

11551155
output
11561156
}
1157-
EmitTo::NextBlock(_) => {
1157+
EmitTo::NextBlock => {
11581158
unreachable!("this group values still not support blocked groups")
11591159
}
11601160
};

datafusion/physical-plan/src/aggregates/group_values/row.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl GroupValues for GroupValuesRows {
229229
});
230230
output
231231
}
232-
EmitTo::NextBlock(_) => {
232+
EmitTo::NextBlock => {
233233
unreachable!("this group values still not support blocked groups")
234234
}
235235
};

datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<O: OffsetSizeTrait> GroupValues for GroupValuesByes<O> {
116116

117117
emit_group_values
118118
}
119-
EmitTo::NextBlock(_) => {
119+
EmitTo::NextBlock => {
120120
unreachable!("this group values still not support blocked groups")
121121
}
122122
};

datafusion/physical-plan/src/aggregates/group_values/single_group_by/bytes_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl GroupValues for GroupValuesBytesView {
117117

118118
emit_group_values
119119
}
120-
EmitTo::NextBlock(_) => {
120+
EmitTo::NextBlock => {
121121
unreachable!("this group values still not support blocked groups")
122122
}
123123
};

0 commit comments

Comments
 (0)