2017-11-09 10 views
0

タイムスタンプをPSTからGMTに変換するときにto_utc_timestamp関数が空白になるという奇妙な問題が発生しました。私は、これが米国で夏時間が切られた日にのみ1時間の範囲で起こっていることがわかりました。夏時間スイッチで入力時間をnullに変換する

Query: select to_utc_timestamp(cast('2017-11-05 01:00:00' as timestamp),'PST') 

Query: select to_utc_timestamp(cast('2017-11-05 01:59:59' as timestamp),'PST') 

上記のクエリは空白の出力を返します。

しかし同じものハイブで正常に動作します:

Query: select to_utc_timestamp(cast('2017-11-05 01:00:00' as timestamp),'PST') 
OK 
2017-11-05 09:00:00 
Query: select to_utc_timestamp(cast('2017-11-05 01:59:59' as timestamp),'PST') 
OK 
2017-11-05 09:59:59 

はインパラクエリ自体を使用してこの問題を回避する方法も同じ理由を理解する手助けとが必要です。

インパラバージョン - CDH 5.10 1.1.0

答えて

0
私はあなたと同じインパラとCDHのバージョンを使用してい

、同じバグプレゼント - CDH 5.10

ハイブのバージョンのv2.7.0。この回避策では、インパラの正しい答えが得られます。

select case 
    when 
     cast('2017-11-05 01:00:00' as timestamp) >= '2017-11-05 01:00:00' and 
     cast('2017-11-05 01:00:00' as timestamp) <= '2017-11-05 01:59:59' 
    then 
     hours_sub(to_utc_timestamp(hours_add('2017-11-05 01:00:00', 1), 'PST'), 1) 
    else 
     to_utc_timestamp(cast('2017-11-05 01:00:00' as timestamp), 'PST') end; 
+0

問題を確認していただきありがとうございます。また、回避策は私のために提案されているように動作します。 – Pushkin