Hive date based partitions -
i have data in following form on hdfs:-
/basedir/yyyymmdd/fixedname/files
where yyyymmdd date folder , files list of files added in directory. need table in hive pick data yyyymmdd/fixedname directory. should work when added new date. e.g. add on 5th march 2013 files added on day go 20130305/fixedname folder. on 6th march 2013, files go 20130306/fixedname folder.
how alter hive table pickup data changing date fixed folder within it?
do have partitioned table? let's have partitioned table column date , want add new data. in case, have add data new directory , tell hive table (specifically metastore) has new partition using alter table add partition command.
let's have not created table yet. in case have create partitioned table , insert data table queries. magic comes when set these 2 flags:
set hive.exec.dynamic.partition=yes set hive.exec.dynamic.partition.mode = nonstrict;
these flags allow dynamic partitions (for more details read here).
remember have directories like:
/date=yyyymmdd/fixedname/files
so have tell hive pick data subdirectories in recursive way. should set following flag (here there better explanation)
set mapred.input.dir.recursive=true;
finally able make queries date , data in subdirectories date specified in query (/date=yyyymmdd/...).
hope helps you.
Comments
Post a Comment