Search

How to access sub directories recursively in Hive queries?



To process directories recursively in Hive, we need to set below two commands in hive session. These two parameters work in conjunction.
Shell
hive> Set mapred.input.dir.recursive=true;
hive> Set hive.mapred.supports.subdirectories=true;
Now hive tables can be pointed to the higher level directory. This is suitable for a scenario where the directory structure is as following: /data/country/state/city