【发布时间】:2016-01-08 00:51:38
【问题描述】:
在我创建的自定义外部表上使用 select 语句时遇到问题。在使用 add partition 命令为年月日创建表后,我已经向该表添加了分区。
我面临的问题是,对于这个选择语句,我只得到一天 = 1 的一行,而我预计 5 天有 5 行。
select * from test_data where key = 'AX001';
对于这些陈述中的每一个,我都会得到一个结果。
select * from test_data where key = 'AX001' and day = 2;
select * from test_data where key = 'AX001' and day = 3;
但为此,我只得到一天 = 2 的一行。
select * from test_data where key = 'AX001' and day in (2,3);
知道这种行为的原因可能是什么吗?
【问题讨论】:
-
什么版本的 Hive? (每个版本都会出现很多错误...) 您实际上将
DAY定义为字符串还是整数?将and DAY in (2,3)替换为and (DAY =2 or DAY =3)会发生什么? -
Hive 0.13.1-CDH5.2.0..我在创建表语句“partitioned by (year int, month int, day int)”中将day定义为int .. and (day=2 or day=3) 也给了我一行 day =2。我刚刚在 (3,4,5) 中尝试了一天,并得到了一天 =3 的一行。