@@ -32,11 +32,11 @@ use arrow::array::{
3232} ;
3333use arrow:: compute;
3434use arrow:: datatypes:: {
35- DataType , Decimal128Type , Decimal256Type , Float16Type , Float32Type , Float64Type ,
36- Int16Type , Int32Type , Int64Type , Int8Type , UInt16Type , UInt32Type , UInt64Type ,
37- UInt8Type ,
35+ DataType , Decimal128Type , Decimal256Type , DurationMicrosecondType ,
36+ DurationMillisecondType , DurationNanosecondType , DurationSecondType , Float16Type ,
37+ Float32Type , Float64Type , Int16Type , Int32Type , Int64Type , Int8Type , IntervalUnit ,
38+ UInt16Type , UInt32Type , UInt64Type , UInt8Type ,
3839} ;
39- use arrow_schema:: IntervalUnit ;
4040use datafusion_common:: stats:: Precision ;
4141use datafusion_common:: {
4242 downcast_value, exec_err, internal_err, ColumnStatistics , DataFusionError , Result ,
@@ -264,6 +264,7 @@ impl AggregateUDFImpl for Max {
264264 | Binary
265265 | LargeBinary
266266 | BinaryView
267+ | Duration ( _)
267268 )
268269 }
269270
@@ -318,6 +319,18 @@ impl AggregateUDFImpl for Max {
318319 Timestamp ( Nanosecond , _) => {
319320 primitive_max_accumulator ! ( data_type, i64 , TimestampNanosecondType )
320321 }
322+ Duration ( Second ) => {
323+ primitive_max_accumulator ! ( data_type, i64 , DurationSecondType )
324+ }
325+ Duration ( Millisecond ) => {
326+ primitive_max_accumulator ! ( data_type, i64 , DurationMillisecondType )
327+ }
328+ Duration ( Microsecond ) => {
329+ primitive_max_accumulator ! ( data_type, i64 , DurationMicrosecondType )
330+ }
331+ Duration ( Nanosecond ) => {
332+ primitive_max_accumulator ! ( data_type, i64 , DurationNanosecondType )
333+ }
321334 Decimal128 ( _, _) => {
322335 primitive_max_accumulator ! ( data_type, i128 , Decimal128Type )
323336 }
@@ -1091,6 +1104,7 @@ impl AggregateUDFImpl for Min {
10911104 | Binary
10921105 | LargeBinary
10931106 | BinaryView
1107+ | Duration ( _)
10941108 )
10951109 }
10961110
@@ -1145,6 +1159,18 @@ impl AggregateUDFImpl for Min {
11451159 Timestamp ( Nanosecond , _) => {
11461160 primitive_min_accumulator ! ( data_type, i64 , TimestampNanosecondType )
11471161 }
1162+ Duration ( Second ) => {
1163+ primitive_min_accumulator ! ( data_type, i64 , DurationSecondType )
1164+ }
1165+ Duration ( Millisecond ) => {
1166+ primitive_min_accumulator ! ( data_type, i64 , DurationMillisecondType )
1167+ }
1168+ Duration ( Microsecond ) => {
1169+ primitive_min_accumulator ! ( data_type, i64 , DurationMicrosecondType )
1170+ }
1171+ Duration ( Nanosecond ) => {
1172+ primitive_min_accumulator ! ( data_type, i64 , DurationNanosecondType )
1173+ }
11481174 Decimal128 ( _, _) => {
11491175 primitive_min_accumulator ! ( data_type, i128 , Decimal128Type )
11501176 }
0 commit comments