Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hive: Filtering Data between Specified Dates when Date is a String

Tags:

I'm trying to filter data between September 1st, 2010 and August 31st, 2013 in a Hive table. The column containing the date is in string format (yyyy-mm-dd). I can use month() and year() on this column. But how do I use them to filter data between the above dates? Any examples/sample code would be welcome!

like image 299
Great_Raisin Avatar asked Jan 29 '14 08:01

Great_Raisin


1 Answers

Just like SQL, Hive supports BETWEEN operator for more concise statement:

SELECT *   FROM your_table   WHERE your_date_column BETWEEN '2010-09-01' AND '2013-08-31'; 
like image 167
cakraww Avatar answered Sep 17 '22 14:09

cakraww