@@ -31,9 +31,10 @@ use arrow::array::{
3131} ;
3232use arrow:: compute;
3333use arrow:: datatypes:: {
34- DataType , Decimal128Type , Decimal256Type , Float16Type , Float32Type , Float64Type ,
35- Int16Type , Int32Type , Int64Type , Int8Type , UInt16Type , UInt32Type , UInt64Type ,
36- UInt8Type ,
34+ DataType , Decimal128Type , Decimal256Type , DurationMicrosecondType ,
35+ DurationMillisecondType , DurationNanosecondType , DurationSecondType , Float16Type ,
36+ Float32Type , Float64Type , Int16Type , Int32Type , Int64Type , Int8Type , UInt16Type ,
37+ UInt32Type , UInt64Type , UInt8Type ,
3738} ;
3839use arrow_schema:: IntervalUnit ;
3940use datafusion_common:: stats:: Precision ;
@@ -240,6 +241,7 @@ impl AggregateUDFImpl for Max {
240241 | Binary
241242 | LargeBinary
242243 | BinaryView
244+ | Duration ( _)
243245 )
244246 }
245247
@@ -294,6 +296,18 @@ impl AggregateUDFImpl for Max {
294296 Timestamp ( Nanosecond , _) => {
295297 primitive_max_accumulator ! ( data_type, i64 , TimestampNanosecondType )
296298 }
299+ Duration ( Second ) => {
300+ primitive_max_accumulator ! ( data_type, i64 , DurationSecondType )
301+ }
302+ Duration ( Millisecond ) => {
303+ primitive_max_accumulator ! ( data_type, i64 , DurationMillisecondType )
304+ }
305+ Duration ( Microsecond ) => {
306+ primitive_max_accumulator ! ( data_type, i64 , DurationMicrosecondType )
307+ }
308+ Duration ( Nanosecond ) => {
309+ primitive_max_accumulator ! ( data_type, i64 , DurationNanosecondType )
310+ }
297311 Decimal128 ( _, _) => {
298312 primitive_max_accumulator ! ( data_type, i128 , Decimal128Type )
299313 }
@@ -1098,6 +1112,7 @@ impl AggregateUDFImpl for Min {
10981112 | Binary
10991113 | LargeBinary
11001114 | BinaryView
1115+ | Duration ( _)
11011116 )
11021117 }
11031118
@@ -1152,6 +1167,18 @@ impl AggregateUDFImpl for Min {
11521167 Timestamp ( Nanosecond , _) => {
11531168 primitive_min_accumulator ! ( data_type, i64 , TimestampNanosecondType )
11541169 }
1170+ Duration ( Second ) => {
1171+ primitive_min_accumulator ! ( data_type, i64 , DurationSecondType )
1172+ }
1173+ Duration ( Millisecond ) => {
1174+ primitive_min_accumulator ! ( data_type, i64 , DurationMillisecondType )
1175+ }
1176+ Duration ( Microsecond ) => {
1177+ primitive_min_accumulator ! ( data_type, i64 , DurationMicrosecondType )
1178+ }
1179+ Duration ( Nanosecond ) => {
1180+ primitive_min_accumulator ! ( data_type, i64 , DurationNanosecondType )
1181+ }
11551182 Decimal128 ( _, _) => {
11561183 primitive_min_accumulator ! ( data_type, i128 , Decimal128Type )
11571184 }
0 commit comments