蜂巢返回错误的日期



在使用日期时,我会从Hive中获得一些奇怪的结果。

对于初学者,我正在使用Hive 1.2.1000.2.4.0.0-169

我有一个表(剪切)的表:

hive> DESCRIBE proto_hourly;
OK                                    
elem                    string                                      
protocol                string                                      
count                   bigint
date_val                date                                        
hour_id                 tinyint                                   
# Partition Information          
# col_name              data_type               comment             
date_val                date                                        
hour_id                 tinyint                                       
Time taken: 0.336 seconds, Fetched: xx row(s)
hive> 

好的,所以我已经加载了今年的数据。我开始注意到一些特定日期的查询中的一些"怪异",但是在一个尖锐的示例中,这是一个非常简单的查询,我只是在要求'2016-06-01',但我回来了'2016-05-31'。为什么

hive> SET i="2016-06-01";
hive> with uniq_dates AS (
    >     SELECT DISTINCT date_val as date_val
    >     FROM proto_hourly
    >     WHERE date_val = date(${hiveconf:i}) )
    > select * from uniq_dates;
Query ID = hive_20160616154318_a75b3343-a2fe-41a5-b02a-d9cda8695c91
Total jobs = 1
Launching Job 1 out of 1

Status: Running (Executing on YARN cluster with App id application_1465936275203_0023)
--------------------------------------------------------------------------------
        VERTICES      STATUS  TOTAL  COMPLETED  RUNNING  PENDING  FAILED  KILLED
--------------------------------------------------------------------------------
Map 1 ..........   SUCCEEDED      1          1        0        0       0       0
Reducer 2 ......   SUCCEEDED      1          1        0        0       0       0
--------------------------------------------------------------------------------
VERTICES: 02/02  [==========================>>] 100%  ELAPSED TIME: 3.63 s     
--------------------------------------------------------------------------------
OK
2016-05-31
Time taken: 6.738 seconds, Fetched: 1 row(s)
hive>

对此进行多一点测试,我发现群集中的另一个时区中配置了一台服务器。三个节点中有两个是UTC,但是一个节点仍在美国/丹佛。

我相信正在发生的事情是地图/减少作业在不同时区的服务器上执行,从而给了我奇怪的数据偏移问题。

日期2016-06-01 UTC确实确实等于日期2016-05-31美国/丹佛

无声TZ转换...

最新更新