Skip to content

Commit 416af46

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

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
@@ -1649,7 +1649,7 @@ mod tests {
16491649
assert_eq!(
16501650
min_res,
16511651
ScalarValue::IntervalYearMonth(Some(IntervalYearMonthType::make_value(
1652-
-2, 4
1652+
-2, 4,
16531653
)))
16541654
);
16551655

@@ -1661,7 +1661,7 @@ mod tests {
16611661
assert_eq!(
16621662
max_res,
16631663
ScalarValue::IntervalYearMonth(Some(IntervalYearMonthType::make_value(
1664-
5, 34
1664+
5, 34,
16651665
)))
16661666
);
16671667

datafusion/sqllogictest/test_files/aggregate.slt

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

3703+
# min_duration, max_duration
3704+
statement ok
3705+
create table d
3706+
as values
3707+
(arrow_cast(1, 'Duration(Second)'), arrow_cast(2, 'Duration(Millisecond)'), arrow_cast(3, 'Duration(Microsecond)'), arrow_cast(4, 'Duration(Nanosecond)')),
3708+
(arrow_cast(11, 'Duration(Second)'),arrow_cast(22, 'Duration(Millisecond)'), arrow_cast(33, 'Duration(Microsecond)'), arrow_cast(44, 'Duration(Nanosecond)'));
3709+
3710+
query ????
3711+
SELECT min(column1), min(column2), min(column3), min(column4) FROM d;
3712+
----
3713+
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
3714+
3715+
query ????
3716+
SELECT max(column1), max(column2), max(column3), max(column4) FROM d;
3717+
----
3718+
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
3719+
3720+
statement ok
3721+
drop table d;
3722+
37033723
# max_bool
37043724
statement ok
37053725
CREATE TABLE max_bool (value BOOLEAN);

0 commit comments

Comments
 (0)