I am connecting to AWS Athena through Mode Analytics Platform and querying a table using its Query Engine ( which is based on Presto 0.172 ). This table public.zones
has time zone information stored in a column called time_zone
on some regions I am interested in, stored as varchar
.
For example if I type:
SELECT time_zone
FROM public.zones
LIMIT 4;
I get (as expected):
time_zone
----------
US/Pacific
US/Eastern
US/Eastern
US/Eastern
I can run this test query:
SELECT
timestamp '2017-06-01 12:34:56.789' AT TIME ZONE 'US/Eastern' AS time_eastern,
time_zone
FROM public.zones
LIMIT 4;
and I get (as expected)
time_eastern time_zone
---------------------------------- ----------
2017-06-01 08:34:56.789 US/Eastern US/Pacific
2017-06-01 08:34:56.789 US/Eastern US/Eastern
2017-06-01 08:34:56.789 US/Eastern US/Eastern
2017-06-01 08:34:56.789 US/Eastern US/Eastern
Now, I want to represent the same time string '2017-06-01 12:34:56.789'
in different time zones that I query from the zones table. I expected the following query to run. (It runs on PostgreSQL).
SELECT
timestamp '2017-06-01 12:34:56.789' AT TIME ZONE time_zone AS time_custom,
time_zone
FROM public.zones
LIMIT 4;
I get the following error:
[Simba][AthenaJDBC](100071) An error has been thrown from the AWS Athena client.
line 2:52: no viable alternative at input 'TIME ZONE time_zone'
What is the reason for this not working in Presto SQL / AWS Athena Query Engine ?
Can anyone suggest any work-arounds or what is my syntactical error if any?