@@ -28,10 +28,12 @@ use arrow::array::{
2828} ;
2929use arrow:: buffer:: { NullBuffer , OffsetBuffer , ScalarBuffer } ;
3030use arrow:: compute:: { SortOptions , filter} ;
31- use arrow:: row:: { Row , RowConverter , Rows , SortField } ;
3231use arrow:: datatypes:: { DataType , Field , FieldRef , Fields } ;
32+ use arrow:: row:: { Row , RowConverter , Rows , SortField } ;
3333
3434use datafusion_common:: cast:: as_list_array;
35+ use datafusion_common:: hash_utils:: { RandomState , create_hashes} ;
36+ use datafusion_common:: utils:: proxy:: HashTableAllocExt ;
3537use datafusion_common:: utils:: {
3638 SingleRowListArrayBuilder , compare_rows, get_row_at_idx, take_function_args,
3739} ;
@@ -48,11 +50,9 @@ use datafusion_functions_aggregate_common::aggregate::groups_accumulator::nulls:
4850use datafusion_functions_aggregate_common:: merge_arrays:: merge_ordered_arrays;
4951use datafusion_functions_aggregate_common:: order:: AggregateOrderSensitivity ;
5052use datafusion_functions_aggregate_common:: utils:: ordering_fields;
51- use datafusion_common:: hash_utils:: { RandomState , create_hashes} ;
52- use datafusion_common:: utils:: proxy:: HashTableAllocExt ;
5353use datafusion_macros:: user_doc;
54- use hashbrown:: hash_table:: HashTable ;
5554use datafusion_physical_expr_common:: sort_expr:: { LexOrdering , PhysicalSortExpr } ;
55+ use hashbrown:: hash_table:: HashTable ;
5656
5757make_udaf_expr_and_func ! (
5858 ArrayAgg ,
@@ -1109,7 +1109,8 @@ impl Accumulator for DistinctArrayAggAccumulator {
11091109 + self . map_size
11101110 + self . counts . capacity ( ) * size_of :: < u64 > ( )
11111111 + self . hashes_buffer . capacity ( ) * size_of :: < u64 > ( )
1112- + self . datatype . size ( ) - size_of_val ( & self . datatype )
1112+ + self . datatype . size ( )
1113+ - size_of_val ( & self . datatype )
11131114 }
11141115}
11151116
@@ -2736,8 +2737,7 @@ mod tests {
27362737 "postgres" , "mysql" , "postgres" , "redis" , "mysql" , "duckdb" , "redis" ,
27372738 ] ) ) ;
27382739
2739- let mut acc =
2740- DistinctArrayAggAccumulator :: try_new ( & DataType :: Utf8 , None , false ) ?;
2740+ let mut acc = DistinctArrayAggAccumulator :: try_new ( & DataType :: Utf8 , None , false ) ?;
27412741 acc. update_batch ( & [ input] ) ?;
27422742
27432743 let result = acc. evaluate ( ) ?;
@@ -2826,8 +2826,9 @@ mod tests {
28262826 use arrow:: array:: Date32Array ;
28272827
28282828 // 7 rows with 4 distinct dates (days since epoch), each duplicate appearing twice.
2829- let input: ArrayRef =
2830- Arc :: new ( Date32Array :: from ( vec ! [ 100i32 , 200 , 100 , 300 , 200 , 400 , 300 ] ) ) ;
2829+ let input: ArrayRef = Arc :: new ( Date32Array :: from ( vec ! [
2830+ 100i32 , 200 , 100 , 300 , 200 , 400 , 300 ,
2831+ ] ) ) ;
28312832
28322833 let mut acc =
28332834 DistinctArrayAggAccumulator :: try_new ( & DataType :: Date32 , None , false ) ?;
0 commit comments