问题
The following discussion seems to indicate that Hive timestamps have a timezone: https://community.hortonworks.com/questions/83523/timestamp-in-hive-without-timezone.html
The apache wiki says "Timestamps are interpreted to be timezoneless and stored as an offset from the UNIX epoch."
I am referring to: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types#LanguageManualTypes-TimestampstimestampTimestamps
If I use code like the following:
from_unixtime(unix_timestamp(ts_field,'yyyy-MM-dd HH:mm:ss'), 'yyyy-MM-dd HH:mm:ss z') as ts_field_tz
This seems to expose an underlying timezone value.
回答1:
The phrase "timezone-less" is misleading; what it means actually is that...
If you have data files written by Hive, those
TIMESTAMPvalues represent the local timezone of the host where the data was written
That is an excerpt from the Impala documentation -- and they make it very explicit, because it's a real pain when you need to access the same table from both Hive and Impala, since contrary to 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
来源:https://stackoverflow.com/questions/44647134/are-timestamps-stored-with-a-timezone-in-apache-hive