title: Create external HIVE table from files with different record formats
body: <p>I would like to create an external HIVE table that utilizes data already in HDFS.  The files are in a directory like <code>/hdfs/data/location</code> and sub directories with the <code>year-month</code> format.  ex: <code>/hdfs/data/location/2013-december</code> and <code>/hdfs/data/location/2014-january</code>.</p>
  
  <p>Within these directories are multiple files but within the files are different types of data (different fields).  Examples of the different types of records are:</p>
  
  <p>Type A</p>
  
  <pre><code>type
  state
  city
  population
  </code></pre>
  
  <p>Type B</p>
  
  <pre><code>type
  zipcode
  registeredvoters
  </code></pre>
  
  <p>Actual data example (tab delimited) </p>
  
  <pre><code>type:A   state:New York  city:New York    population:8336697
  type:A   state:California  city:Los Angeles population:3857799
  type:B   zipcode:92118  registeredvoters:794051
  type:B   zipcode:92155  registeredvoters:794053
  type:A   state:Illinois    city:Chicago population:2714856
  </code></pre>
  
  <p>The data is already in this format and being used by other processes outside of HIVE, so changing it may not be an option.  I would also not want to duplicate the data in HDFS.</p>
  
  <p><strong>Is there a way to create a HIVE table for only a given type as defined in the data above?</strong></p>
  
  <p>Here is what I have so far for the create:</p>
  
  <pre><code>create external table population (
    type string,
    state string,
    city string,
    population int
  )
  location '/hdfs/data/location';
  </code></pre>