gpt4 book ai didi

hadoop - 时间戳是否与 Apache Hive 中的时区一起存储?

转载 作者:可可西里 更新时间:2023-11-01 14:45:15 24 4
gpt4 key购买 nike

下面的讨论似乎表明 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

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

最佳答案

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

If you have data files written by Hive, those TIMESTAMP values represent the local timezone of the host where the data was written

这是 Impala documentation 的摘录-- 他们说得非常明确,因为当您需要从 Hive Impala 访问同一个表时,这真的很痛苦,因为与 Hive 相反...

By default, Impala does not store timestamps using the local timezone, to avoid undesired results from unexpected time zone issues. Timestamps are stored and interpreted relative to UTC

关于hadoop - 时间戳是否与 Apache Hive 中的时区一起存储?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44647134/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com