4

This query works fine:

select percentile_approx(values, 0.75)
from t1 
inner join t2 on (t1.id = t2.id) and t1.id = 123;

But this query throws an error:

select percentile_approx(values, cast(t2.percent as double ))
from t1 
inner join t2 on (t1.id = t2.id) and t1.id = 123;

FAILED: UDFArgumentTypeException The second argument must be a constant, but double was passed instead.

How can I make the second argument (percentile) dynamic (coming from a different table)?

Note: There will be greater than 1000 calculations and will also involve doing a group by; so running 1 by 1 is not an option -- in that case, it would be 1,000 different Hive queries which would run forever.

o-90
  • 17,045
  • 10
  • 39
  • 63
cikavladimir
  • 443
  • 2
  • 5
  • 11

0 Answers0