title: Query issue with Hive
body: <p>I have a partitioned table in Hive with partitioned columns as e_year,e_month and e_day (all as strings). If i hardcode the values the query come out fine but if I try to make it more generic it gets stuck and times out. Could you please tell me what's the issue? The table is 5-6TB in size</p>
  
  <p>Query:</p>
  
  <pre><code>select count(*),
         e_type,
         e_src_type
  from   table1
  where e_year=
        cast(substr(date_sub(From_unixtime(unix_timestamp()), 4),1,4) as string)
  and   e_month=
        cast(substr(date_sub(From_unixtime(unix_timestamp()), 4),6,2) as string)
  and  e_day=
       cast(substr(date_sub(From_unixtime(unix_timestamp()), 4),9,2) as string)
  group by e_type,
           e_src_type
  </code></pre>
  
  <p>This comes out:</p>
  
  <pre><code>select  count(*),
          e_type, 
          e_src_type
  from    table1
  where   e_year='2015'
  and     e_month='02'
  and     e_day='02'
  group by e_type,
          e_src_type
  </code></pre>