|
18 | 18 | //! [`GroupValues`] trait for storing and interning group keys |
19 | 19 |
|
20 | 20 | use arrow::array::types::{ |
21 | | - Date32Type, Date64Type, Decimal128Type, Int8Type, Int16Type, Int32Type, Int64Type, |
22 | | - Time32MillisecondType, Time32SecondType, Time64MicrosecondType, Time64NanosecondType, |
23 | | - TimestampMicrosecondType, TimestampMillisecondType, TimestampNanosecondType, |
24 | | - TimestampSecondType, UInt8Type, UInt16Type, UInt32Type, UInt64Type, |
| 21 | + Date32Type, Date64Type, Decimal128Type, Time32MillisecondType, Time32SecondType, |
| 22 | + Time64MicrosecondType, Time64NanosecondType, TimestampMicrosecondType, |
| 23 | + TimestampMillisecondType, TimestampNanosecondType, TimestampSecondType, |
25 | 24 | }; |
26 | 25 | use arrow::array::{ArrayRef, downcast_primitive}; |
27 | 26 | use arrow::datatypes::{DataType, SchemaRef, TimeUnit}; |
@@ -52,11 +51,6 @@ mod metrics; |
52 | 51 | mod null_builder; |
53 | 52 |
|
54 | 53 | 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 | | -} |
60 | 54 |
|
61 | 55 | /// Stores the group values during hash aggregation. |
62 | 56 | /// |
@@ -206,16 +200,49 @@ pub fn new_group_values( |
206 | 200 | DataType::Dictionary(key_type, value_type) => { |
207 | 201 | if supported_single_dictionary_value(value_type) { |
208 | 202 | 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), |
| 203 | + // TODO: turn this into a macro |
| 204 | + DataType::Int8 => { |
| 205 | + Ok(Box::new(GroupValuesDictionary::< |
| 206 | + arrow::datatypes::Int8Type, |
| 207 | + >::new(value_type))) |
| 208 | + } |
| 209 | + DataType::Int16 => { |
| 210 | + Ok(Box::new(GroupValuesDictionary::< |
| 211 | + arrow::datatypes::Int16Type, |
| 212 | + >::new(value_type))) |
| 213 | + } |
| 214 | + DataType::Int32 => { |
| 215 | + Ok(Box::new(GroupValuesDictionary::< |
| 216 | + arrow::datatypes::Int32Type, |
| 217 | + >::new(value_type))) |
| 218 | + } |
| 219 | + DataType::Int64 => { |
| 220 | + Ok(Box::new(GroupValuesDictionary::< |
| 221 | + arrow::datatypes::Int64Type, |
| 222 | + >::new(value_type))) |
| 223 | + } |
| 224 | + DataType::UInt8 => { |
| 225 | + Ok(Box::new(GroupValuesDictionary::< |
| 226 | + arrow::datatypes::UInt8Type, |
| 227 | + >::new(value_type))) |
| 228 | + } |
| 229 | + DataType::UInt16 => { |
| 230 | + Ok(Box::new(GroupValuesDictionary::< |
| 231 | + arrow::datatypes::UInt16Type, |
| 232 | + >::new(value_type))) |
| 233 | + } |
| 234 | + DataType::UInt32 => { |
| 235 | + Ok(Box::new(GroupValuesDictionary::< |
| 236 | + arrow::datatypes::UInt32Type, |
| 237 | + >::new(value_type))) |
| 238 | + } |
| 239 | + DataType::UInt64 => { |
| 240 | + Ok(Box::new(GroupValuesDictionary::< |
| 241 | + arrow::datatypes::UInt64Type, |
| 242 | + >::new(value_type))) |
| 243 | + } |
217 | 244 | _ => Err(datafusion_common::DataFusionError::NotImplemented( |
218 | | - format!("Unsupported dictionary key type: {key_type:?}"), |
| 245 | + format!("Unsupported dictionary key type: {key_type:?}",), |
219 | 246 | )), |
220 | 247 | }; |
221 | 248 | } |
|
0 commit comments