-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Provide AT ZONE-equivalent functions where zone name is not constant #135
Comments
We should pick a proper name for these functions. I don’t think it be just named at_timezone. What these functions do is convert an unzoned time or timestamp to a zoned one. We have other places in the function library where we do conversions, so we should try to stay consistent. |
@martint we also need a function to convert
Shall we have 2 functions then? The second one is clearly only a shorthand, but might be a useful one. |
Also, |
There are a bunch of references to this function in stackoverflow, so at the very least we would need to deprecate the old name. |
JFYI, other database's function/syntax are: |
@ebyhr thanks for listing these. Do you know which of these databases have standards-compliant |
As far as I searched, @findepi told me on slack, postgres doesn't have it, also redshift and bigquery may be same. Thank you for the information. |
@martint do you have thoughts on the above function names from other systems? |
To recap, what we (possibly?) need are these behaviors:
1 and 2 seem straightforward to explain and understand given the semantics of those two types. While 3 sounds convenient, I'm concerned about being able to come up with a name and explanation of the behavior that's easy and intuitive. I'd prefer not to add it unless there's demand for it. For 1, some possible names: For 2, it might make sense to keep the name as |
@martint what about |
I'd say, let's leave that one out. It seems an uncommon use case with a reasonable workaround. If there's demand later, we can consider adding such a function. |
@martint what about using |
While it's tempting to say "having both functions named the same is consistent with the AT TIMEZONE syntax", it's important to note that the spec disallows AT TIMEZONE if the declared type of the argument is of type DATE. Built-in language constructs can afford to have special rules about coercibility that general functions can't.
As a side note, we have a function named |
i am fine with |
Yeah, |
Summing up:
|
@findepi Sorry for my late reply. Probably, I don't have enough time to work on that, therefore hope someone develop it. |
It's really weird that presto doesn't have ANY way to convert UTC timestamp to another timezone but without having the timezone string. |
@RosterIn I am not sure I fully understand your needs. I invite you to Presto community Slack (https://prestosql.io/community.html), I will be happy if I can help in your particular use-case. |
@findepi The problem: |
@RosterIn If I understand this correctly, you want timestamp to represent local date/time with no implicit relation to any time zone. |
Fixed by #1612 |
makeat_timezone
it public (see @dain 's prestodb/presto#5162 (comment)) and add documentationThis is required to perform AT TIME ZONE conversion when zone is not a constant
See #135 (comment) comment below for what should be implemented in this issue.
Ref prestodb/presto#5162
The text was updated successfully, but these errors were encountered: