Skip to content

Commit b8165d3

Browse files
committed
reduced PR
1 parent 680d0e6 commit b8165d3

2 files changed

Lines changed: 185 additions & 2752 deletions

File tree

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

Lines changed: 33 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;
@@ -51,13 +50,6 @@ use crate::aggregates::{
5150
mod metrics;
5251
mod null_builder;
5352

54-
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-
6153
/// Stores the group values during hash aggregation.
6254
///
6355
/// # Background
@@ -206,14 +198,36 @@ pub fn new_group_values(
206198
DataType::Dictionary(key_type, value_type) => {
207199
if supported_single_dictionary_value(value_type) {
208200
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),
201+
DataType::Int8 => Ok(Box::new(
202+
GroupValuesDictionary::<Int8Type>::new(value_type),
203+
)),
204+
DataType::Int16 => Ok(Box::new(
205+
GroupValuesDictionary::<Int16Type>::new(value_type),
206+
)),
207+
DataType::Int32 => Ok(Box::new(
208+
GroupValuesDictionary::<Int32Type>::new(value_type),
209+
)),
210+
DataType::Int64 => Ok(Box::new(
211+
GroupValuesDictionary::<Int64Type>::new(value_type),
212+
)),
213+
DataType::UInt8 => Ok(Box::new(
214+
GroupValuesDictionary::<UInt8Type>::new(value_type),
215+
)),
216+
DataType::UInt16 => {
217+
Ok(Box::new(GroupValuesDictionary::<UInt16Type>::new(
218+
value_type,
219+
)))
220+
}
221+
DataType::UInt32 => {
222+
Ok(Box::new(GroupValuesDictionary::<UInt32Type>::new(
223+
value_type,
224+
)))
225+
}
226+
DataType::UInt64 => {
227+
Ok(Box::new(GroupValuesDictionary::<UInt64Type>::new(
228+
value_type,
229+
)))
230+
}
217231
_ => Err(datafusion_common::DataFusionError::NotImplemented(
218232
format!("Unsupported dictionary key type: {key_type:?}"),
219233
)),
@@ -231,7 +245,6 @@ pub fn new_group_values(
231245
Ok(Box::new(GroupValuesColumn::<true>::try_new(schema)?))
232246
}
233247
} else {
234-
// TODO: add specialized implementation for dictionary encoding columns for 2+ group by columns case
235248
Ok(Box::new(GroupValuesRows::try_new(schema)?))
236249
}
237250
}

0 commit comments

Comments
 (0)