Here is an operation you can perform in Athena-
SELECT date_utc AT TIME ZONE 'America/Chicago'
FROM
(
SELECT TIMESTAMP '2018-09-09 12:00:00' as date_utc
) x;
In other sql engines you can change America/Chicago to a column-
SELECT date_utc AT TIME ZONE x.timezone
FROM
(
SELECT
TIMESTAMP '2018-09-09 12:00:00' as date_utc,
'America/Chicago' as timezone
) x;
In Athena you get-
line 1:30: no viable alternative at input 'time zone x'
Should it be possible to use x.timezone in Athena? This seems like a bug.
It indeed looks like a bug in the engine. What is interesting however is, that the underlying function works with a column parameter. So you can use this as a workaround.
SELECT at_timezone(date_utc,x.timezone)
FROM
(
SELECT
TIMESTAMP '2018-09-09 12:00:00' as date_utc,
'America/Chicago' as timezone
) x;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With