deprecated.legacy-timestamp 应该如何在 Presto 0.220 中工作?

How is deprecated.legacy-timestamp supposed to work in Presto 0.220?

我在正确读取时间戳时遇到问题,在 EMR 上的 Presto 上没有任何自动转换。

示例:在 AWS Glue 目录中,我有一个 table 带有 UTC 时间的时间戳列(数据类型时间戳)。在 Athena 中查询时,他们 return 符合预期。在 EMR(EMR 5.26,Presto 0.220)上的 Presto 中查询时,会自动转换到不同的时区。

Presto 文档在此处描述了一种禁用此行为的方法 - https://prestosql.io/docs/current/language/timestamp

The legacy semantics can be enabled using the deprecated.legacy-timestamp config property. Setting it to true (the default) enables the legacy semantics, whereas setting it to false enables the new semantics.

他们在底部概述了将此选项设置为真与假的结果差异

Query: SELECT TIME '10:00:00 Asia/Kathmandu' AT TIME ZONE 'UTC' Legacy result: 04:30:00.000 UTC New result: 04:15:00.000 UTC

在我的 EMR 配置中(在 presto-config 中)将 deprecated.legacy-timestamp 设置为 true 之后,我仍然根据此测试查询获得新结果,(我的 UTC 时间戳是仍在自动转换中)。

关于启用遗留时间戳行为我还需要做什么的任何建议?

传统时间戳行为仍然是默认行为,您可以在 https://github.com/prestosql/presto/issues/37 跟踪当前状态。显然 Athena 评估时间戳就像 Presto 在 运行 使用 UTC 会话区域时所做的那样。

从 Presto 317 开始,您可以使用配置强制客户端会话区域 属性:

 sql.forced-session-time-zone=UTC

对于所有 Presto 版本,您都可以设置客户端会话区域。如何执行此操作取决于所使用的特定客户端。例如,使用 presto-cli 你通常会做

java -Duser.timezone=UTC -jar presto-cli.jar