alamb commented on code in PR #15310: URL: https://github.com/apache/datafusion/pull/15310#discussion_r2004167614
########## datafusion/sqllogictest/test_files/aggregate.slt: ########## @@ -3807,6 +3807,38 @@ SELECT MIN(value), MAX(value) FROM timestampmicrosecond statement ok DROP TABLE timestampmicrosecond; +# min_duration, max_duration +statement ok +create table d +as values + (arrow_cast(1, 'Duration(Second)'), arrow_cast(2, 'Duration(Millisecond)'), arrow_cast(3, 'Duration(Microsecond)'), arrow_cast(4, 'Duration(Nanosecond)'), 1), + (arrow_cast(11, 'Duration(Second)'),arrow_cast(22, 'Duration(Millisecond)'), arrow_cast(33, 'Duration(Microsecond)'), arrow_cast(44, 'Duration(Nanosecond)'), 1); + +query ???? +SELECT min(column1), min(column2), min(column3), min(column4) FROM d; +---- +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 + +query ???? +SELECT max(column1), max(column2), max(column3), max(column4) FROM d; +---- +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 + +# GROUP BY follows a different code path Review Comment: I also added some tests when there is GROUP BY in the query as that takes a different code path I actually double checked and there is a way to make this kind of query faster, which I filed as - https://github.com/apache/datafusion/issues/15317 ########## datafusion/sqllogictest/test_files/aggregate.slt: ########## @@ -3807,6 +3807,26 @@ SELECT MIN(value), MAX(value) FROM timestampmicrosecond statement ok DROP TABLE timestampmicrosecond; +# min_duration, max_duration +statement ok +create table d +as values + (arrow_cast(1, 'Duration(Second)'), arrow_cast(2, 'Duration(Millisecond)'), arrow_cast(3, 'Duration(Microsecond)'), arrow_cast(4, 'Duration(Nanosecond)')), + (arrow_cast(11, 'Duration(Second)'),arrow_cast(22, 'Duration(Millisecond)'), arrow_cast(33, 'Duration(Microsecond)'), arrow_cast(44, 'Duration(Nanosecond)')); + +query ???? +SELECT min(column1), min(column2), min(column3), min(column4) FROM d; Review Comment: I verified these queries fail without this change: ```sql > SELECT min(column1), min(column2), min(column3), min(column4) FROM d; Internal error: Min/Max accumulator not implemented for type Duration(Second). This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker > ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org