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

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

the test, the correct answer is 1.
hive> select * from max_corr ;
OK
1       2
2       4
3       6
Time taken: 2.304 seconds
hive> select corr(a,b) from max_corr ;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks determined at compile time: 1
In order to change the average load for a reducer (in bytes):
  set hive.exec.reducers.bytes.per.reducer=<number>
In order to limit the maximum number of reducers:
  set hive.exec.reducers.max=<number>
In order to set a constant number of reducers:
  set mapred.reduce.tasks=<number>
Starting Job = job_201207232322_2781, Tracking URL = 
http://*****/jobdetails.jsp?jobid=job_201207232322_2781
Kill Command = /usr/lib/hadoop/bin/hadoop job  
-Dmapred.job.tracker=hdfs://***** -kill job_201207232322_2781
2012-09-12 10:04:17,663 Stage-1 map = 0%,  reduce = 0%
2012-09-12 10:04:20,681 Stage-1 map = 100%,  reduce = 0%
2012-09-12 10:04:27,720 Stage-1 map = 100%,  reduce = 33%
2012-09-12 10:04:28,728 Stage-1 map = 100%,  reduce = 100%
Ended Job = job_201207232322_2781
OK
0.27586206896551724
Time taken: 15.088 seconds
hive> 

                
> 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.9.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