-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support SUM
AVG
, MIN
, MAX
on Time
columns.
#3166
Comments
I also think this is a relatively good first issue as it requires following the model for existing aggregates (e.g. SUM(int64)) so marking it as such. |
@alamb postgrseql cast |
@waitingkuo notes that postgres does: willy=# select pg_typeof(SUM(time '00:00:00')), pg_typeof(AVg(time '00:00:00'));
pg_typeof | pg_typeof
-----------+-----------
interval | interval
(1 row) this make sense otherwise SUM(Time) is just quite strange |
|
@alamb i think we could add more expressions like |
SUM
or AVG
on Time
columns. SUM
AVG
, MIN
, MAX
on Time
columns.
do we have interval for now? select '00:00:00'::interval;
NotImplemented("Unsupported SQL type Interval") but this works ❯ select interval '1 second';
+------------------------------------------------+
| IntervalDayTime("1000") |
+------------------------------------------------+
| 0 years 0 mons 0 days 0 hours 0 mins 1.00 secs |
+------------------------------------------------+ |
@alamb should we use IntervalMonthDayNano insead? this is what we have for now
|
Since we are treating ❯ select arrow_typeof(cast('10:00:00' as time));
+-----------------------------------------------------------+
| arrowtypeof(CAST(Utf8("10:00:00") AS Time64(Nanosecond))) |
+-----------------------------------------------------------+
| Time64(Nanosecond) |
+-----------------------------------------------------------+
1 row in set. Query took 0.038 seconds. |
🤔 looks like another feature gap #3167 (comment) |
@alamb |
@alamb i've created a pull request for max and min #3178
❯ select min(t), max(t) from (select '00:00:00' as t union select '00:00:01' union select '00:00:02');
+----------+----------+
| MIN(t) | MAX(t) |
+----------+----------+
| 00:00:00 | 00:00:02 |
+----------+----------+
1 row in set. Query took 0.009 seconds.
❯ |
Thanks @waitingkuo -- I am starting to work through my review backlog and will catch up with this shortly |
cc @ovr |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
DataFusion does not support
SUM
,AVG
,MIN
orMAX
onTime
type columns a standard SQL feature that could be used to sum how much cumulative time was spent doing some operation, for exampleReproducer is as follows:
Doing so today will result in
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
N/A
Additional context
As described in #200
The text was updated successfully, but these errors were encountered: