我通过 Mode Analytics Platform 连接到 AWS Athena 并使用其查询引擎(基于 Presto 0.172 )查询表。这张表public.zones
时区信息存储在名为的列中time_zone
在我感兴趣的一些区域,存储为varchar
.
例如,如果我输入:
SELECT time_zone
FROM public.zones
LIMIT 4;
我得到(如预期):
time_zone
----------
US/Pacific
US/Eastern
US/Eastern
US/Eastern
我可以运行这个测试查询:
SELECT
timestamp '2017-06-01 12:34:56.789' AT TIME ZONE 'US/Eastern' AS time_eastern,
time_zone
FROM public.zones
LIMIT 4;
我得到(如预期)
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
现在,我想表示相同的时间字符串'2017-06-01 12:34:56.789'
我从区域表中查询的不同时区。我期望运行以下查询。 (它在 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;
我收到以下错误:
[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'
在 Presto SQL/AWS Athena 查询引擎中不起作用的原因是什么?
任何人都可以建议任何解决方法或者我的语法错误(如果有)是什么?