[ 
https://issues.apache.org/jira/browse/HIVE-3455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458416#comment-13458416
 ] 

Maxim Bolotin commented on HIVE-3455:
-------------------------------------

the whole point of the bug is that the MERGE part is wrong, not the MAP, you 
can't test it with just inline array, you have to have at least to pieces to 
merge in a reducer. please check again the formula in the merge part.

                
> ANSI CORR(X,Y) is incorrect
> ---------------------------
>
>                 Key: HIVE-3455
>                 URL: https://issues.apache.org/jira/browse/HIVE-3455
>             Project: Hive
>          Issue Type: Bug
>          Components: UDF
>    Affects Versions: 0.7.1, 0.8.0, 0.8.1, 0.9.0, 0.10.0
>            Reporter: Maxim Bolotin
>
> A simple test with 2 collinear vectors returns a wrong result.
> The problem is the merge of variances, file:
> http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCorrelation.java?revision=1157222&view=markup
> lines:
> 347: myagg.xvar += xvarB + (xavgA-xavgB) * (xavgA-xavgB) * myagg.count;
> 348: myagg.yvar += yvarB + (yavgA-yavgB) * (yavgA-yavgB) * myagg.count;
> the correct merge should be like this:
> 347: myagg.xvar += xvarB+(xavgA - xavgB)*(xavgA-xavgB)/myagg.count*nA*nB;
> 348: myagg.yvar += yvarB+(yavgA - yavgB)*(yavgA-yavgB)/myagg.count*nA*nB;

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to