HaiWang
HaiWang

Reputation: 187

weird exception in Hive : Error in semantic analysis

Maybe when you see the "Error in semantic" in the title, you consider it as syntax error? Of course not, I will show you what happened.

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

I'm very sure the table does exist in the database android. After the first statement failed, it appears that the table is missing.(Even I add the db prefix in the table name)

I'm wonderring whether it's because of the volumn of data is very big, maybe you have noticed that the time range is [20121001, 20121231]. I run the command before many times, always raise this error. But if I change the contition to "p_date='20121001'", the statement can run normally. (since the volumn is smaller? )

I'm expecting your answers, Thanks.

Upvotes: 3

Views: 4343

Answers (1)

www
www

Reputation: 4391

Probably you are in strict mode. One of strict mode feature is that partitions has to be specified, so this is why queries with "p_date='20121001'" in where cause are working.

Please try the non-strict mode:

set hive.mapred.mode=nonstrict;

Upvotes: 1

Related Questions