Skip to content

Commit f8ff947

Browse files
committed
reduced PR
1 parent 680d0e6 commit f8ff947

File tree

3 files changed

+203
-2752
lines changed

3 files changed

+203
-2752
lines changed

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

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// Licensed to the Apache Software Foundation (ASF) under one
2-
// or more contributor license agreements. See the NOTICE file
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
32
// distributed with this work for additional information
43
// regarding copyright ownership. The ASF licenses this file
54
// to you under the Apache License, Version 2.0 (the
@@ -31,8 +30,8 @@ use datafusion_expr::EmitTo;
3130

3231
pub mod multi_group_by;
3332

34-
pub mod row;
35-
pub mod single_group_by;
33+
mod row;
34+
mod single_group_by;
3635
use datafusion_physical_expr::binary_map::OutputType;
3736
use multi_group_by::GroupValuesColumn;
3837
use row::GroupValuesRows;
@@ -49,14 +48,8 @@ use crate::aggregates::{
4948
};
5049

5150
mod metrics;
52-
mod null_builder;
53-
5451
pub(crate) use metrics::GroupByMetrics;
55-
macro_rules! make_dict {
56-
($t:ty, $value_type:expr) => {
57-
Ok(Box::new(GroupValuesDictionary::<$t>::new($value_type)))
58-
};
59-
}
52+
mod null_builder;
6053

6154
/// Stores the group values during hash aggregation.
6255
///
@@ -206,14 +199,36 @@ pub fn new_group_values(
206199
DataType::Dictionary(key_type, value_type) => {
207200
if supported_single_dictionary_value(value_type) {
208201
return match key_type.as_ref() {
209-
DataType::Int8 => make_dict!(Int8Type, value_type),
210-
DataType::Int16 => make_dict!(Int16Type, value_type),
211-
DataType::Int32 => make_dict!(Int32Type, value_type),
212-
DataType::Int64 => make_dict!(Int64Type, value_type),
213-
DataType::UInt8 => make_dict!(UInt8Type, value_type),
214-
DataType::UInt16 => make_dict!(UInt16Type, value_type),
215-
DataType::UInt32 => make_dict!(UInt32Type, value_type),
216-
DataType::UInt64 => make_dict!(UInt64Type, value_type),
202+
DataType::Int8 => Ok(Box::new(
203+
GroupValuesDictionary::<Int8Type>::new(value_type),
204+
)),
205+
DataType::Int16 => Ok(Box::new(
206+
GroupValuesDictionary::<Int16Type>::new(value_type),
207+
)),
208+
DataType::Int32 => Ok(Box::new(
209+
GroupValuesDictionary::<Int32Type>::new(value_type),
210+
)),
211+
DataType::Int64 => Ok(Box::new(
212+
GroupValuesDictionary::<Int64Type>::new(value_type),
213+
)),
214+
DataType::UInt8 => Ok(Box::new(
215+
GroupValuesDictionary::<UInt8Type>::new(value_type),
216+
)),
217+
DataType::UInt16 => {
218+
Ok(Box::new(GroupValuesDictionary::<UInt16Type>::new(
219+
value_type,
220+
)))
221+
}
222+
DataType::UInt32 => {
223+
Ok(Box::new(GroupValuesDictionary::<UInt32Type>::new(
224+
value_type,
225+
)))
226+
}
227+
DataType::UInt64 => {
228+
Ok(Box::new(GroupValuesDictionary::<UInt64Type>::new(
229+
value_type,
230+
)))
231+
}
217232
_ => Err(datafusion_common::DataFusionError::NotImplemented(
218233
format!("Unsupported dictionary key type: {key_type:?}"),
219234
)),
@@ -231,7 +246,6 @@ pub fn new_group_values(
231246
Ok(Box::new(GroupValuesColumn::<true>::try_new(schema)?))
232247
}
233248
} else {
234-
// TODO: add specialized implementation for dictionary encoding columns for 2+ group by columns case
235249
Ok(Box::new(GroupValuesRows::try_new(schema)?))
236250
}
237251
}

0 commit comments

Comments
 (0)