[
https://issues.apache.org/jira/browse/PIG-2718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brian Tan updated PIG-2718:
---------------------------
Description:
1.txt:
1, 2, 3
4, 5, 6
7, 8, 9
a = load '1.txt' using PigStorage(',') as (x:double, y:double, z:double);
b = group a all;
c = foreach b generate COV(a.$0, a.$0);
Following exception is thrown:
Caused by: java.io.IOException: Caught exception processing input
at org.apache.pig.builtin.COV.combine(COV.java:279)
at org.apache.pig.builtin.COV$Intermed.exec(COV.java:170)
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to
java.lang.Double
at org.apache.pig.builtin.COV.combine(COV.java:266)
http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/COV.java
This can be fixed by changing count on line 259 from double to long, and
tempCount on line 221 from double to long
New observation:
If I make a trivial change to the above script, the existing implementation
runs without error. Very weird.
a = load '1.txt' using PigStorage(',') as (x:double, y:double, z:double);
b = group a all;
c = foreach b generate a.$0 as w;
d = foreach c generate COV(w, w);
was:
1.txt:
1, 2, 3
4, 5, 6
7, 8, 9
a = load '1.txt' using PigStorage(',') as (x:double, y:double, z:double);
b = group a all;
c = foreach b generate COV(a.$0, a.$0);
Following exception is thrown:
Caused by: java.io.IOException: Caught exception processing input
at org.apache.pig.builtin.COV.combine(COV.java:279)
at org.apache.pig.builtin.COV$Intermed.exec(COV.java:170)
Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to
java.lang.Double
at org.apache.pig.builtin.COV.combine(COV.java:266)
http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/COV.java
This can be easily fixed by changing count on line 259 from double to long, and
tempCount on line 221 from double to long
> Error casting Long to Double inside the COV UDF
> -----------------------------------------------
>
> Key: PIG-2718
> URL: https://issues.apache.org/jira/browse/PIG-2718
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.9.2, 0.10.0
> Reporter: Brian Tan
>
> 1.txt:
> 1, 2, 3
> 4, 5, 6
> 7, 8, 9
> a = load '1.txt' using PigStorage(',') as (x:double, y:double, z:double);
> b = group a all;
> c = foreach b generate COV(a.$0, a.$0);
> Following exception is thrown:
> Caused by: java.io.IOException: Caught exception processing input
> at org.apache.pig.builtin.COV.combine(COV.java:279)
> at org.apache.pig.builtin.COV$Intermed.exec(COV.java:170)
> Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to
> java.lang.Double
> at org.apache.pig.builtin.COV.combine(COV.java:266)
> http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/COV.java
> This can be fixed by changing count on line 259 from double to long, and
> tempCount on line 221 from double to long
> New observation:
> If I make a trivial change to the above script, the existing implementation
> runs without error. Very weird.
> a = load '1.txt' using PigStorage(',') as (x:double, y:double, z:double);
> b = group a all;
> c = foreach b generate a.$0 as w;
> d = foreach c generate COV(w, w);
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira