【问题标题】:Are timestamps stored with a timezone in Apache Hive?时间戳是否与 Apache Hive 中的时区一起存储?
【发布时间】:2017-11-22 15:33:11
【问题描述】:

以下讨论似乎表明 Hive 时间戳具有时区: https://community.hortonworks.com/questions/83523/timestamp-in-hive-without-timezone.html

apache wiki 说“时间戳被解释为无时区,并存储为与 UNIX 纪元的偏移量。”

我指的是:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-TimestampstimestampTimestamps

如果我使用如下代码:

from_unixtime(unix_timestamp(ts_field,'yyyy-MM-dd HH:mm:ss'), 'yyyy-MM-dd HH:mm:ss z') as ts_field_tz

这似乎暴露了一个潜在的时区值。

【问题讨论】:

    标签: hadoop hive hiveql


    【解决方案1】:

    短语“无时区”具有误导性;它的实际意思是……

    如果你有 Hive 写入的数据文件,那些 TIMESTAMP 值 表示写入数据的主机的本地时区

    这是Impala documentation 的摘录——而且它们非常明确,因为当您需要从 Hive Impala 访问同一个表时,这真的很痛苦,因为与蜂巢...

    默认情况下,Impala 不使用本地时区存储时间戳, 以避免意外的时区问题导致不希望的结果。 相对于 UTC 存储和解释时间戳

    【讨论】:

      猜你喜欢
      • 2016-01-17
      • 2015-03-10
      • 1970-01-01
      • 1970-01-01
      • 2016-02-06
      • 1970-01-01
      • 2015-04-02
      • 1970-01-01
      相关资源
      最近更新 更多