title: How to create an external Hive table with column typed Timestamp
body: <p>I want to create an external Hive table from a text file containing epoch in HDFS. Let's say the file is located at the <code>/user/me/test.txt</code>. Here's the file content:</p>
  
  <pre><code>1354183921
  1354183922
  </code></pre>
  
  <p>I have Hive 0.8.1 installed and should be able to use type Timestamp, so I created the table:</p>
  
  <pre><code>hive&gt; CREATE EXTERNAL TABLE test1 (epoch Timestamp)
        LOCATION '/user/me';
  </code></pre>
  
  <p>Then I queried the table:</p>
  
  <pre><code>SELECT * FROM test1;
  </code></pre>
  
  <p>and got the following exception:</p>
  
  <pre><code>Failed with exception java.io.IOException:java.lang.IllegalArgumentException: 
  Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
  </code></pre>
  
  <p>Have I missed anything when creating the external table? I'm confused because Hive (since 0.8) supports Timestamp in the format of Unix epoch in second: <a href="https://cwiki.apache.org/Hive/languagemanual-types.html#LanguageManualTypes-Timestamps" rel="nofollow">https://cwiki.apache.org/Hive/languagemanual-types.html#LanguageManualTypes-Timestamps</a></p>