@@ -31,8 +31,8 @@ use datafusion_expr::EmitTo;
3131
3232pub mod multi_group_by;
3333
34- pub mod row;
35- pub mod single_group_by;
34+ mod row;
35+ mod single_group_by;
3636use datafusion_physical_expr:: binary_map:: OutputType ;
3737use multi_group_by:: GroupValuesColumn ;
3838use row:: GroupValuesRows ;
@@ -49,14 +49,8 @@ use crate::aggregates::{
4949} ;
5050
5151mod metrics;
52- mod null_builder;
53-
5452pub ( 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- }
53+ mod null_builder;
6054
6155/// Stores the group values during hash aggregation.
6256///
@@ -206,14 +200,36 @@ pub fn new_group_values(
206200 DataType :: Dictionary ( key_type, value_type) => {
207201 if supported_single_dictionary_value ( value_type) {
208202 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+ DataType :: Int8 => Ok ( Box :: new (
204+ GroupValuesDictionary :: < Int8Type > :: new ( value_type) ,
205+ ) ) ,
206+ DataType :: Int16 => Ok ( Box :: new (
207+ GroupValuesDictionary :: < Int16Type > :: new ( value_type) ,
208+ ) ) ,
209+ DataType :: Int32 => Ok ( Box :: new (
210+ GroupValuesDictionary :: < Int32Type > :: new ( value_type) ,
211+ ) ) ,
212+ DataType :: Int64 => Ok ( Box :: new (
213+ GroupValuesDictionary :: < Int64Type > :: new ( value_type) ,
214+ ) ) ,
215+ DataType :: UInt8 => Ok ( Box :: new (
216+ GroupValuesDictionary :: < UInt8Type > :: new ( value_type) ,
217+ ) ) ,
218+ DataType :: UInt16 => {
219+ Ok ( Box :: new ( GroupValuesDictionary :: < UInt16Type > :: new (
220+ value_type,
221+ ) ) )
222+ }
223+ DataType :: UInt32 => {
224+ Ok ( Box :: new ( GroupValuesDictionary :: < UInt32Type > :: new (
225+ value_type,
226+ ) ) )
227+ }
228+ DataType :: UInt64 => {
229+ Ok ( Box :: new ( GroupValuesDictionary :: < UInt64Type > :: new (
230+ value_type,
231+ ) ) )
232+ }
217233 _ => Err ( datafusion_common:: DataFusionError :: NotImplemented (
218234 format ! ( "Unsupported dictionary key type: {key_type:?}" ) ,
219235 ) ) ,
@@ -231,7 +247,6 @@ pub fn new_group_values(
231247 Ok ( Box :: new ( GroupValuesColumn :: < true > :: try_new ( schema) ?) )
232248 }
233249 } else {
234- // TODO: add specialized implementation for dictionary encoding columns for 2+ group by columns case
235250 Ok ( Box :: new ( GroupValuesRows :: try_new ( schema) ?) )
236251 }
237252}
0 commit comments