Re: Invoke a UDAF inside another UDAF

2012-02-01 Thread rohan monga
nda.com www: fxtrade.com > e: mgro...@oanda.com > > "Best Trading Platform" - World Finance's Forex Awards 2009. > "The One to Watch" - Treasury Today's Adam Smith Awards 2009. > > > ----- Original Message - > From: "rohan monga" &

Re: Invoke a UDAF inside another UDAF

2012-02-01 Thread Mark Grover
: fxtrade.com e: mgro...@oanda.com "Best Trading Platform" - World Finance's Forex Awards 2009. "The One to Watch" - Treasury Today's Adam Smith Awards 2009. - Original Message - From: "rohan monga" To: user@hive.apache.org Sent: Friday, January 20, 20

Re: Invoke a UDAF inside another UDAF

2012-01-20 Thread rohan monga
my bad, i hastily converted the query to a wrong example. it should be like this select f1, avg(f2) as avg_f2, avg(f2 - avg_f2) from table group by f1; In essence, I just want to use the value generated by one UDAF ( in this case avg(f2) ) as a single number and then apply that value to the grou

Re: Invoke a UDAF inside another UDAF

2012-01-20 Thread Edward Capriolo
IMHO You can not possibly nest the percentile calculation because the results would be meaningless. percentile has to aggregate a set and pick the Nth element, But if you nest then the inner percentile only returns one result to the outer percentile, and that is pretty meaningless. (I think someon

Re: Invoke a UDAF inside another UDAF

2012-01-20 Thread rohan monga
thanks edward that seems to work :) However, I have another query is like this select a, avg(b) as avg_b, percentile_approx( avg_b - percentile_approx( b, .5), .5 ) from table1 group by a Here I will loose the group info if I include the inner query in the FROM clause, is there a way to get thi

Re: Invoke a UDAF inside another UDAF

2012-01-20 Thread Edward Capriolo
I think if you are grouping by b, b has to be in your select list. Try this. FROM ( select b,count(a) as theCount from table one group by b ) a select mean(theCount); I think that should work. On 1/20/12, rohan monga wrote: > Hi, > I am trying to run a query like > "select mean(count(a)) from ta

Invoke a UDAF inside another UDAF

2012-01-20 Thread rohan monga
Hi, I am trying to run a query like "select mean(count(a)) from table1 group by b;" I am getting the following error FAILED: Hive Internal Error: java.lang.NullPointerException(null) java.lang.NullPointerException at org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc.newInstance(ExprNodeG