0
votes

I have tried to use the correlation function in a hive, But it provides the following error for me

Error:

Error while compiling statement: FAILED: SemanticException [Error 10128]: line 4:7 Not yet supported place for UDAF like sum, avg, etc..

What I am trying to do is I have 3 columns like a, b, c. I have to do the corr() function against the avg(a,b) and c.

My Query is

    select 
        (avg(a) + avg(b) / 2) as rateA, 
        avg(c) rateB, 
        corr( rateA, rateanyonefrom servey

Can any one please help me with this?

Thanks in advance.

1

1 Answers

0
votes

Issue is with your query,

You cannot have alias of one column in the same select clause.

Try select corr(rateA, rateB), rateA, rateB from (select (avg(a) + avg(g) / 2) as rateA, avg(c) as rateB from tableName) t1;

Hope this helps