title: Aggregated column use in Hive Query
body: <p>My hive table (tab1) structure:</p>
  
  <pre><code>people_id,time_spent,group_type
  1,234,a
  2,540,b
  1,332,a
  2,112,b
  </code></pre>
  
  <p>Below is the query i am trying to execute but getting error ("Not yet supported place for UDAF 'sum'"):</p>
  
  <pre><code>select people_id, sum(case when group_type='a' then time_spent else 0 end) as a_time, sum(pow(a_time,2)) as s_sq_a_time,sum(case when group_type='b' then time_spent else 0 end) as b_time, sum(pow(b_time,2)) as s_sq_b_time from tab1 group by people_id;
  </code></pre>
  
  <p>Is it possible to refer aggregated column from same select statement in Hive?
  I have also referred below link but it didnt work:
  <a href="http://grokbase.com/t/hive/user/095tpdkrgz/built-in-aggregate-function-standard-deviation#" rel="nofollow">http://grokbase.com/t/hive/user/095tpdkrgz/built-in-aggregate-function-standard-deviation#</a> </p>