Skip to content

Commit 5a2918a

Browse files
author
B Vadlamani
committed
remove_boxing_smaller_int_types
1 parent df90ef5 commit 5a2918a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

  • datafusion
    • functions-aggregate-common/src/aggregate/count_distinct
    • functions-aggregate/src

datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ impl<T: ArrowPrimitiveType + Debug> Accumulator for FloatDistinctCountAccumulato
170170
/// Uses 256 bytes to track all possible u8 values.
171171
#[derive(Debug)]
172172
pub struct BoolArray256DistinctCountAccumulator {
173-
seen: Box<[bool; 256]>,
173+
seen: [bool; 256],
174174
}
175175

176176
impl BoolArray256DistinctCountAccumulator {
177177
pub fn new() -> Self {
178178
Self {
179-
seen: Box::new([false; 256]),
179+
seen: [false; 256],
180180
}
181181
}
182182

@@ -251,13 +251,13 @@ impl Accumulator for BoolArray256DistinctCountAccumulator {
251251
/// Uses 256 bytes to track all possible i8 values (mapped to 0..255).
252252
#[derive(Debug)]
253253
pub struct BoolArray256DistinctCountAccumulatorI8 {
254-
seen: Box<[bool; 256]>,
254+
seen: [bool; 256],
255255
}
256256

257257
impl BoolArray256DistinctCountAccumulatorI8 {
258258
pub fn new() -> Self {
259259
Self {
260-
seen: Box::new([false; 256]),
260+
seen: [false; 256],
261261
}
262262
}
263263

datafusion/functions-aggregate/src/count.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ impl Count {
174174
}
175175
fn get_count_accumulator(data_type: &DataType) -> Box<dyn Accumulator> {
176176
match data_type {
177-
// Use optimized bitmap/bool array accumulators for small integer types
177+
// Optimized bitmap/bool array accumulators for small integer types
178178
DataType::UInt8 => Box::new(BoolArray256DistinctCountAccumulator::new()),
179179
DataType::Int8 => Box::new(BoolArray256DistinctCountAccumulatorI8::new()),
180180
DataType::UInt16 => Box::new(Bitmap65536DistinctCountAccumulator::new()),
181181
DataType::Int16 => Box::new(Bitmap65536DistinctCountAccumulatorI16::new()),
182-
// Use HashSet-based accumulator for larger integer types
182+
// HashSet-based accumulator for larger integer types
183183
DataType::Int32 => Box::new(PrimitiveDistinctCountAccumulator::<Int32Type>::new(
184184
data_type,
185185
)),

0 commit comments

Comments
 (0)