title: Hive: external partitioned table from Avro
body: <p>Is it possible to create an external table in Hive based on Avro files that also add columns for the directory partitions:</p>
  
  <p>Let's say I have data stored in <code>/data/demo/dt=2016-02-01</code> and so on. I then tried the following but I get 0 rows when I select from the table:</p>
  
  <pre><code>CREATE EXTERNAL TABLE demo
    PARTITIONED BY (date STRING)
    ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
    STORED AS AVRO
    LOCATION '/data/demo/'
    TBLPROPERTIES ('avro.schema.url' = 'hdfs:///path/to/schema.avsc');
  </code></pre>
  
  <p>I tried without the <code>PARTITIONED BY</code> clause and then I get the records but obviously without the <code>key=value</code> directory partitions. Is this at all possible?</p>