@@ -24,7 +24,8 @@ use crate::aggregate::groups_accumulator::prim_op::PrimitiveGroupsAccumulator;
2424use crate :: { AggregateExpr , PhysicalExpr } ;
2525use arrow:: compute;
2626use arrow:: datatypes:: {
27- DataType , Date32Type , Date64Type , Time32MillisecondType , Time32SecondType ,
27+ DataType , Date32Type , Date64Type , DurationMicrosecondType , DurationMillisecondType ,
28+ DurationNanosecondType , DurationSecondType , Time32MillisecondType , Time32SecondType ,
2829 Time64MicrosecondType , Time64NanosecondType , TimeUnit , TimestampMicrosecondType ,
2930 TimestampMillisecondType , TimestampNanosecondType , TimestampSecondType ,
3031} ;
@@ -193,6 +194,7 @@ impl AggregateExpr for Max {
193194 | Time32 ( _)
194195 | Time64 ( _)
195196 | Timestamp ( _, _)
197+ | Duration ( _)
196198 )
197199 }
198200
@@ -241,6 +243,18 @@ impl AggregateExpr for Max {
241243 Timestamp ( Nanosecond , _) => {
242244 instantiate_max_accumulator ! ( self , i64 , TimestampNanosecondType )
243245 }
246+ Duration ( Second ) => {
247+ instantiate_max_accumulator ! ( self , i64 , DurationSecondType )
248+ }
249+ Duration ( Millisecond ) => {
250+ instantiate_max_accumulator ! ( self , i64 , DurationMillisecondType )
251+ }
252+ Duration ( Microsecond ) => {
253+ instantiate_max_accumulator ! ( self , i64 , DurationMicrosecondType )
254+ }
255+ Duration ( Nanosecond ) => {
256+ instantiate_max_accumulator ! ( self , i64 , DurationNanosecondType )
257+ }
244258 Decimal128 ( _, _) => {
245259 instantiate_max_accumulator ! ( self , i128 , Decimal128Type )
246260 }
@@ -945,6 +959,7 @@ impl AggregateExpr for Min {
945959 | Time32 ( _)
946960 | Time64 ( _)
947961 | Timestamp ( _, _)
962+ | Duration ( _)
948963 )
949964 }
950965
@@ -992,6 +1007,18 @@ impl AggregateExpr for Min {
9921007 Timestamp ( Nanosecond , _) => {
9931008 instantiate_min_accumulator ! ( self , i64 , TimestampNanosecondType )
9941009 }
1010+ Duration ( Second ) => {
1011+ instantiate_min_accumulator ! ( self , i64 , DurationSecondType )
1012+ }
1013+ Duration ( Millisecond ) => {
1014+ instantiate_min_accumulator ! ( self , i64 , DurationMillisecondType )
1015+ }
1016+ Duration ( Microsecond ) => {
1017+ instantiate_min_accumulator ! ( self , i64 , DurationMicrosecondType )
1018+ }
1019+ Duration ( Nanosecond ) => {
1020+ instantiate_min_accumulator ! ( self , i64 , DurationNanosecondType )
1021+ }
9951022 Decimal128 ( _, _) => {
9961023 instantiate_min_accumulator ! ( self , i128 , Decimal128Type )
9971024 }
0 commit comments