Hive中奇怪的异常:语义分析出错

时间:2013-03-02 08:22:36

标签: hadoop hive thrift

也许当你在标题中看到“语义错误”时,你认为它是语法错误? 当然不是,我会告诉你发生了什么。

hive> use android;
OK
Time taken: 0.223 seconds
hive> desc tb_user_basics;
OK
col_datetime    string  
col_is_day_new  string  
col_is_hour_new string  
col_ch  string  
...
p_date  string  
p_hourmin   string  
Time taken: 0.189 seconds
hive> select count(distinct col_udid) from android.tb_user_basics where p_date>='20121001' and p_date<='20121231';
FAILED: Error in semantic analysis: org.apache.thrift.transport.TTransportException: java.net.SocketTimeoutException: Read timed out
hive> 
> 
> select count(distinct col_udid) from android.tb_user_basics where p_date>='20121001' and p_date<='20121231';
FAILED: Error in semantic analysis: Unable to fetch table tb_user_basics

我非常确定这个表确实存在于数据库android中。在第一个语句失败后,似乎缺少该表。(甚至我在表名中添加了db前缀)

我想知道是否因为数据量非常大,也许您已经注意到时间范围是[20121001,20121231]。 我多次运行命令,总是引发此错误。但是如果我将转换更改为“p_date ='20121001'”,则该语句可以正常运行。 (因为体积较小?)

我期待你的回答,谢谢。

1 个答案:

答案 0 :(得分:1)

可能你处于严格模式。严格模式功能之一是必须指定分区,因此这就是在原因有效的情况下查询“p_date ='20121001'”的原因。

请尝试非严格模式:

set hive.mapred.mode=nonstrict;