title: Hive partition pruning on computed column
body: <p>I have a few tables on Hive and my query is trying to retrieve the data for the past x days. Hive is pruning the partitions when I use a direct date, but is doing a full table scan when using a formula instead.</p>
  
  <pre><code>select *
  from   f_event
  where  date_key &gt; 20160101;
  
  scanned partitions..
  
  s3://...key=20160102 [f]
  s3://...key=20160103 [f]
  s3://...key=20160104 [f]
  </code></pre>
  
  <p>If I use a formula, say, to get the past 4 weeks of data</p>
  
  <pre><code>Select count(*)
  From    f_event f
  Where  date_key  &gt; from_unixtime(unix_timestamp()-2*7*60*60*24, 'yyyyMMdd')
  </code></pre>
  
  <p><strong>This is scanning all partitions in the table.</strong></p>
  
  <p>environment : Hadoop 2.6.0, EMR, Hive on S3, Hive 1.0.0</p>