Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Won't Do
-
3.3.0
-
None
-
None
Description
Currently, the SQL function to_utc_timestamp is confusing: it just takes the timestamp value in the local timezone and then pretends it’s in the provided timezone and then returns the UTC value, but the result is still treated as local timezone!
The same issue happens in from_utc_timestamp as well.
We even tried to deprecated in the OSS community: https://github.com/apache/spark/commit/c5e83ab92c0cb514963209dc3e70ba0e24570082
We should make TO_UTC_TIMESTAMP and FROM_UTC_TIMESTAMP return TimestampNTZ, which makes a lot of sense. converting the current local time to/from UTC local time.
The functions should accept both Timestamp types:
1. given TimestampLTZ, convert it to TimestampNTZ and continue step #2
2. given TimestampNTZ, convert it as to/from UTC local time.