Skip to content

Commit 4748db3

Browse files
svranesevicavantgardnerio
authored andcommitted
Support Duration in min/max agg functions (#284) (apache#15310) v47
Co-authored-by: svranesevic <[email protected]>
1 parent 951cb6a commit 4748db3

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

datafusion/functions-aggregate/src/min_max.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ mod tests {
16401640
assert_eq!(
16411641
min_res,
16421642
ScalarValue::IntervalYearMonth(Some(IntervalYearMonthType::make_value(
1643-
-2, 4
1643+
-2, 4,
16441644
)))
16451645
);
16461646

@@ -1652,7 +1652,7 @@ mod tests {
16521652
assert_eq!(
16531653
max_res,
16541654
ScalarValue::IntervalYearMonth(Some(IntervalYearMonthType::make_value(
1655-
5, 34
1655+
5, 34,
16561656
)))
16571657
);
16581658

datafusion/sqllogictest/test_files/aggregate.slt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,6 +3751,26 @@ SELECT MIN(value), MAX(value) FROM timestampmicrosecond
37513751
statement ok
37523752
DROP TABLE timestampmicrosecond;
37533753

3754+
# min_duration, max_duration
3755+
statement ok
3756+
create table d
3757+
as values
3758+
(arrow_cast(1, 'Duration(Second)'), arrow_cast(2, 'Duration(Millisecond)'), arrow_cast(3, 'Duration(Microsecond)'), arrow_cast(4, 'Duration(Nanosecond)')),
3759+
(arrow_cast(11, 'Duration(Second)'),arrow_cast(22, 'Duration(Millisecond)'), arrow_cast(33, 'Duration(Microsecond)'), arrow_cast(44, 'Duration(Nanosecond)'));
3760+
3761+
query ????
3762+
SELECT min(column1), min(column2), min(column3), min(column4) FROM d;
3763+
----
3764+
0 days 0 hours 0 mins 1 secs 0 days 0 hours 0 mins 0.002 secs 0 days 0 hours 0 mins 0.000003 secs 0 days 0 hours 0 mins 0.000000004 secs
3765+
3766+
query ????
3767+
SELECT max(column1), max(column2), max(column3), max(column4) FROM d;
3768+
----
3769+
0 days 0 hours 0 mins 11 secs 0 days 0 hours 0 mins 0.022 secs 0 days 0 hours 0 mins 0.000033 secs 0 days 0 hours 0 mins 0.000000044 secs
3770+
3771+
statement ok
3772+
drop table d;
3773+
37543774
# max_bool
37553775
statement ok
37563776
CREATE TABLE max_bool (value BOOLEAN);

0 commit comments

Comments
 (0)