@@ -28,9 +28,9 @@ use arrow::{
2828 array:: {
2929 ArrayRef , BasicDecimalArray , Date32Array , Date64Array , Float32Array ,
3030 Float64Array , Int16Array , Int32Array , Int64Array , Int8Array , LargeStringArray ,
31- StringArray , TimestampMicrosecondArray , TimestampMillisecondArray ,
32- TimestampNanosecondArray , TimestampSecondArray , UInt16Array , UInt32Array ,
33- UInt64Array , UInt8Array ,
31+ StringArray , Time64NanosecondArray , TimestampMicrosecondArray ,
32+ TimestampMillisecondArray , TimestampNanosecondArray , TimestampSecondArray ,
33+ UInt16Array , UInt32Array , UInt64Array , UInt8Array ,
3434 } ,
3535 datatypes:: Field ,
3636} ;
@@ -257,6 +257,9 @@ macro_rules! min_max_batch {
257257 ) ,
258258 DataType :: Date32 => typed_min_max_batch!( $VALUES, Date32Array , Date32 , $OP) ,
259259 DataType :: Date64 => typed_min_max_batch!( $VALUES, Date64Array , Date64 , $OP) ,
260+ DataType :: Time64 ( TimeUnit :: Nanosecond ) => {
261+ typed_min_max_batch!( $VALUES, Time64NanosecondArray , Time64 , $OP)
262+ }
260263 other => {
261264 // This should have been handled before
262265 return Err ( DataFusionError :: Internal ( format!(
@@ -433,12 +436,18 @@ macro_rules! min_max {
433436 ) => {
434437 typed_min_max!( lhs, rhs, Date32 , $OP)
435438 }
436- (
439+ (
437440 ScalarValue :: Date64 ( lhs) ,
438441 ScalarValue :: Date64 ( rhs) ,
439442 ) => {
440443 typed_min_max!( lhs, rhs, Date64 , $OP)
441444 }
445+ (
446+ ScalarValue :: Time64 ( lhs) ,
447+ ScalarValue :: Time64 ( rhs) ,
448+ ) => {
449+ typed_min_max!( lhs, rhs, Time64 , $OP)
450+ }
442451 e => {
443452 return Err ( DataFusionError :: Internal ( format!(
444453 "MIN/MAX is not expected to receive scalars of incompatible types {:?}" ,
@@ -1190,4 +1199,28 @@ mod tests {
11901199 DataType :: Date64
11911200 )
11921201 }
1202+
1203+ #[ test]
1204+ fn min_time64 ( ) -> Result < ( ) > {
1205+ let a: ArrayRef = Arc :: new ( Time64NanosecondArray :: from ( vec ! [ 1 , 2 , 3 , 4 , 5 ] ) ) ;
1206+ generic_test_op ! (
1207+ a,
1208+ DataType :: Time64 ( TimeUnit :: Nanosecond ) ,
1209+ Max ,
1210+ ScalarValue :: Time64 ( Some ( 5 ) ) ,
1211+ DataType :: Time64 ( TimeUnit :: Nanosecond )
1212+ )
1213+ }
1214+
1215+ #[ test]
1216+ fn max_time64 ( ) -> Result < ( ) > {
1217+ let a: ArrayRef = Arc :: new ( Time64NanosecondArray :: from ( vec ! [ 1 , 2 , 3 , 4 , 5 ] ) ) ;
1218+ generic_test_op ! (
1219+ a,
1220+ DataType :: Time64 ( TimeUnit :: Nanosecond ) ,
1221+ Max ,
1222+ ScalarValue :: Time64 ( Some ( 5 ) ) ,
1223+ DataType :: Time64 ( TimeUnit :: Nanosecond )
1224+ )
1225+ }
11931226}
0 commit comments