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

Vivek Padmanabhan commented on PIG-2159:
----------------------------------------

The issue could be reproduced using the above mentioned script. A sample input 
is provided below ;
{code}
input1
100,101,102,103,104,105
110,111,112,113,114,115

input2
200,201,202,203,204,205
210,211,212,213,214,215

input0
100,101,102,103,104,105
200,201,202,203,204,205
{code}



The logical plan from explain for 0.9;
#-----------------------------------------------
# New Logical Plan:
#-----------------------------------------------
Final: (Name: LOStore Schema: total#95:double)
|
|---Final: (Name: LOForEach Schema: total#95:double)
     |   |
     |   (Name: LOGenerate[false] Schema: 
total#95:double)ColumnPrune:InputUids=[91]ColumnPrune:OutputUids=[95]
     |   |   |
     |   |   (Name: UserFunc(org.apache.pig.builtin.DoubleSum) Type: 
double Uid: 95)




The logical plan from explain for 0.8;
#-----------------------------------------------
# New Logical Plan:
#-----------------------------------------------
fake: (Name: LOStore Schema: total#68:long)
|
|---Final: (Name: LOForEach Schema: total#68:long)
     |   |
     |   (Name: LOGenerate[false] Schema: 
total#68:long)ColumnPrune:InputUids=[66]ColumnPrune:OutputUids=[68]
     |   |   |
     |   |   (Name: UserFunc(org.apache.pig.builtin.LongSum) Type: long 
Uid: 68)
     |   |   |
     |   |   |---(Name: Dereference Type: bag Uid: 67 Column:[3])
     |   |       |
     |   |       |---Porj:(Name: Project Type: bag Uid: 66 Input: 0 
Column: (*))
     |   |
     |   |---Porj: (Name: LOInnerLoad[1] Schema: 
f1#43:int,f2#44:int,f3#45:int,f4#59:long,f5#60:double)


> New logical plan uses incorrect class for  SUM causing for ClassCastException
> -----------------------------------------------------------------------------
>
>                 Key: PIG-2159
>                 URL: https://issues.apache.org/jira/browse/PIG-2159
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>             Fix For: 0.9.0
>
>
> The below is my script;
> {code}
> A = load 'input1' using PigStorage(',')  as 
> (f1:int,f2:int,f3:int,f4:long,f5:double);
> B = load 'input2' using PigStorage(',')  as 
> (f1:int,f2:int,f3:int,f4:long,f5:double);
> C = load 'input_Main' using PigStorage(',')  as (f1:int,f2:int,f3:int);
> U = UNION ONSCHEMA A,B;
> J = join C by (f1,f2,f3) LEFT OUTER, U by (f1,f2,f3);
> Porj = foreach J generate C::f1 as f1 ,C::f2 as f2,C::f3 as f3,U::f4 as 
> f4,U::f5 as f5;
> G = GROUP Porj by (f1,f2,f3,f5);
> Final = foreach G generate SUM(Porj.f4) as total;
> dump Final;
> {code}
> The script fails at while computing the sum with class cast exception.
> Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to 
> java.lang.Double
>          at org.apache.pig.builtin.DoubleSum$Initial.exec(DoubleSum.java:82)
>          ... 19 more
> This is clearly a bug in the logical plan created in 0.9. The sum operation 
> should have processed using org.apache.pig.builtin.LongSum, but instead 0.9 
> logical plan have used org.apache.pig.builtin.DoubleSum which is meant for 
> sum of doubles. And hence the ClassCastException.
> The same script works fine with Pig 0.8.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to