hadoop - query hive partitioned table over date/time range -


my hive table partitioned on year, month, day, hour

now want fetch data 2014-05-27 2014-06-05 how can that??

i know 1 option create partition on epoch(or yyyy-mm-dd-hh) , in query pass epoch time. can without loosing date hierarchy??

table structure

create table if not exists table1 (col1 int, col2 int) partitioned (year int, month int, day int, hour int)  stored textfile; 

this similar scenario face everyday while querying tables in hive. have partitioned our tables similar way explained , has helped lot if querying. how partition:

create table if not exists table1 (col1 int, col2 int) partitioned (year bigint, month bigint, day bigint, hour int)  stored textfile; 

for partitions assign values this:

year = 2014, month = 201409, day = 20140924, hour = 01 

this way querying becomes simple , can directly query:

select * table1 day >= 20140527 , day < 20140605  

hope helps


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -