-
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 make_interval function #6951
Comments
cc @alamb @waitingkuo please help to add this issue to #3148 |
@liukun4515 |
hi @liukun4515 Do you plan to support multiple time unit? for example column |
I adding the arrow knows how to parse strings like |
@alamb Maybe you can assign it to me. I can help with this issue |
Is anybody working on this? cc: @alamb I could really use it in the work that I am doing. (Supporting interval multiplication/division by integers; supporting Date32 + integer). If nobody's on it, I can take a stab |
FWIW DataFusion already does support interval syntax (though not > select '2021-01-01'::timestamp + interval '1 year';
+-----------------------------------------------------------------------------------------------------------+
| Utf8("2021-01-01") + IntervalMonthDayNano("IntervalMonthDayNano { months: 12, days: 0, nanoseconds: 0 }") |
+-----------------------------------------------------------------------------------------------------------+
| 2022-01-01T00:00:00 |
+-----------------------------------------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.045 seconds. The cast workaround works ok too |
This is insufficient. Suppose we want to do something like this:
This wouldn't be representable using the interval syntax. Why do I want to have it? I want to be able to write this, which works in Postgres:
My current thinking is to desugar it into this:
Does this make sense? It's a little clunky, but that's my current working plan. If somebody has a better idea, speak now or forever hold. |
There is no reason for Therefore I propose we re-purpose this issue to support |
Agreed
I thought it might be clearer if we filed a new ticket with a clear description of the feature, so I did so in: Thus closing this ticket as not planned. Please reopen or comment if you disagree |
@waitingkuo @alamb
I want to implement a app or function like this
datetime + integer with timeunit
, and the timeunit may beyear
,month
,day
.I can't find the any method to convert the
integer with timeunit
to the interval, but in the PG which has a functionmake_interval()
https://www.postgresql.org/docs/current/functions-datetime.html can do this.I just can find a way to resolve the issue by using the
concat
method.For example: I have a table like below, and want to convert the
b
withday
unit to intervalUsing the concat to get the
utf8
expr which can be casted to interval.Originally posted by @liukun4515 in #3148 (comment)
The text was updated successfully, but these errors were encountered: