-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support Duration in min/max agg functions #15310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| query ????I | ||
| SELECT min(column1), min(column2), min(column3), min(column4), column5 FROM d GROUP BY column5; | ||
| ---- | ||
| 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 1 | ||
|
|
||
| query ????I | ||
| SELECT max(column1), max(column2), max(column3), max(column4), column5 FROM d GROUP BY column5; | ||
| ---- | ||
| 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 1 | ||
|
|
||
|
|
||
| statement ok | ||
| drop table d; | ||
|
|
||
| # max_bool | ||
| statement ok | ||
| CREATE TABLE max_bool (value BOOLEAN); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified these queries fail without this change: