Reputation: 1491
I have a directory in HDFS (say /user/hduser/table1) and under that directory there are multiple directories for different timestamps like /user/hduser/table1/20160912000000
, /user/hduser/table1/20160912100000
and /user/hduser/table1/20160912121000
How can I read all the files which are under those three directories through one HIVE external table. Means what do I have to specify in HIVE table's LOCATION parameter.
Upvotes: 0
Views: 625
Reputation: 1491
I am able to read nested folders with the below settings.
set hive.mapred.supports.subdirectories=true;
set mapred.input.dir.recursive=true;
I did set it while creating the table and then able to select data from the table. Location keyword I mentioned as below
LOCATION '/user/hduser/table1/'
Upvotes: 1
Reputation: 4957
Try below code
CREATE TABLE TABLEname (coll INT, coll STRING, coll INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘,’
LOCATION ‘/user/hduser/table1/*/*’;
Upvotes: 0