在impala中utc到pst的转换

oymdgrw7  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(432)

在impala中,对于某些时间戳,我在从utc转换到pst时得到了不正确的数据。当我在配置单元中运行相同的查询时,我得到了正确的数据,但是在impala中,对于某些日期,pst转换不正确。
Impala :

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

Hive:

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

要克服这个问题,有没有其他方法可以将utc转换为pst

szqfcxe2

szqfcxe21#

在 Impala 中使用低于时区的转换。from\u utc\u timestamp(时间戳,字符串时区)

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)

相关问题