Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to select data from hive with specific partition?

Tags:

hadoop

hive

everyone. here are the interactions with the hive:

hive> show partitions TABLENAME
pt=2012.07.28.08/is_complete=1
pt=2012.07.28.09/is_complete=1
pt=2012.07.28.10/is_complete=1
pt=2012.07.28.11/is_complete=1
hive> select * from TABLENAME where pt='2012.07.28.10/is_complete=1' limit 1;
OK
Time taken: 2.807 seconds
hive> select * from TABLENAME where pt='2012.07.28.10' limit 1;
OK
61806fd3-5535-42a1-9ca5-91676d0e783f    1.160.243.215.1343401203879.1   2012-07-28 23:36:37
Time taken: 3.8 seconds
hive>

My question is that why the first select can't get the data?

like image 806
Tim Avatar asked Jul 28 '12 10:07

Tim


1 Answers

"is_complete" is a column just like "pt" so the correct query is:

select * from TABLENAME where pt='2012.07.28.10' and is_complete='1' limit 1;
like image 67
Paul M Avatar answered Sep 19 '22 11:09

Paul M