在impala中进行pst转换

时间:2017-05-30 15:40:59

标签: hive impala pst

在Impala中,对于某些时间戳,我在从UTC转换为PST时收到的数据不正确。当我在hive中运行相同的查询时,我获得了正确的数据,但在impala中,PST转换在某些日期没有正常运行。 / p>

帕拉:

select from_utc_timestamp('2006-08-30 08:00:00','PST')
2006-08-30 01:00:00

蜂巢:

select from_utc_timestamp('2006-08-30 08:00:00','PST')
2006-08-30 00:00:00

要克服是否有另一种方法将utc转换为PST

1 个答案:

答案 0 :(得分:0)

在Impala中使用以下时区转换。     from_utc_timestamp(timestamp,string timezone)

timezone :
for Eastern Time:  America/New_York or EST5EDT
for Central Time:  America/Chicago or CST6CDT
for Mountain Time: America/Denver or MST7MDT
    Phoenix  won't observe daylight saving time: America/Phoenix

for Pacific Time:  America/Los_Angeles or PST8PDT
for Alaska Time:   America/Anchorage or America/Juneau
for Hawaii Time:   America/Adak or EST5EDT
    Honolulu  won't observe day light saving time: Pacific/Honolulu

select from_utc_timestamp('2017-03-11 13:41:22.084','America/Los_Angeles')
    2017-03-11 05:41:22.084000000                                        

select from_utc_timestamp('2017-03-12 13:41:22.084','America/Los_Angeles')
    2017-03-12 06:41:22.084000000                                       

select from_utc_timestamp('2017-11-03 13:41:22.084','America/Los_Angeles')
    2017-11-03 06:41:22.084000000                                    

select from_utc_timestamp('2017-11-04 13:41:22.084','America/Los_Angeles')
   2017-11-04 06:41:22.084000000                                        

select from_utc_timestamp('2017-11-05 13:41:22.084','America/Los_Angeles')
   2017-11-05 05:41:22.084000000                                       
**Daylight saving time(2017) ends at 2:00 AM on Sunday, November 5**   
select from_utc_timestamp('2017-11-05 08:58:00.000','America/Los_Angeles')
  2017-11-05 01:58:00 (UTC -7hrs)                                                

select from_utc_timestamp('2017-11-05 08:59:00.000','America/Los_Angeles')
  2017-11-05 01:59:00 (UTC -7hrs)                                                   

select from_utc_timestamp('2017-11-05 09:00:00.000','America/Los_Angeles')
  2017-11-05 01:00:00   (UTC -8hrs)                                               

select from_utc_timestamp('2017-11-05 09:01:00.000','America/Los_Angeles')
  2017-11-05 01:01:00  (UTC -8hrs)