title: Hive create table with inputs from nested sub-directories
body: <p>I have data in Avro format in HDFS in file paths like: <code>/data/logs/[foldername]/[filename].avro</code>. I want to create a Hive table over all these log files, i.e. all files of the form <code>/data/logs/*/*</code>. (They're all based on the same Avro schema.)</p>
  
  <p>I'm running the below query with flag <code>mapred.input.dir.recursive=true</code>:</p>
  
  <pre><code>CREATE EXTERNAL TABLE default.testtable
    ROW FORMAT SERDE
    'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
    STORED AS INPUTFORMAT
    'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
    OUTPUTFORMAT
    'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
    LOCATION 'hdfs://.../data/*/*'
    TBLPROPERTIES (
      'avro.schema.url'='hdfs://.../schema.avsc') 
  </code></pre>
  
  <p><strong>The table ends up being empty unless I change <code>LOCATION</code> to be less nested</strong>, i.e. to be <code>'hdfs://.../data/[foldername]/'</code> with a certain foldername. This worked no-problem with a less nested path for <code>LOCATION</code>.</p>
  
  <p>I'd like to be able to source data from all these different [foldername] folders. <strong>How do I make the recursive input selection go further in my nested directories?</strong></p>