Search code examples
hadoophivehiveqlhueapache-hive

How to query on a specific date and time range using hive query language taking input from the user?


I have a table in a database in hive. The table is partitioned based on year month and day.

My query looks something like this

select entity1,entity2
from table_t
  INNER JOIN tab_roll.cha alias2
  ON alias1.sid = alias2.sid

  INNER JOIN net_roll.net alias3
  ON alias2.id=alias3.id 
  where event= 'unknown' 
  and day >= 10 and day < 12
  and month >= 5 and month < 11
  and year = 2014

now I want to get results between say mm-dd-yyy HH : MM :SS and mm-dd-yyy HH : MM :SS, how should I do that?

Is is possible to have a pop up where the user chooses the date/time ranges?

Don't know if this helps but the data has about 500 million rows. Thanks


Solution

  • I think Between should work for you. & to optimize this you can index that column too.