You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by li...@sina.com on 2016/05/05 06:38:46 UTC

回复:Re: exception when use multiple "store"s

Thanks a lot.the most minimal input (test.txt) contains one line "c 12".You may visit this link (https://issues.apache.org/jira/browse/PIG-4883) for a more clear version.

----- --- -----
From: Steve Terrell <st...@oculus360.us>
To:user@pig.apache.org, licstar@sina.com
Subj: Re: exception when use multiple "store"s
Date 2016-05-04 23:09

Please provide the the most minimal input (test.txt) required to reproduce
the error.
On Wed, May 4, 2016 at 8:28 AM, <li...@sina.com> wrote:
>  The following code and data will raise an exception.However, if I remove
> any of the four "store"s, the code will be fine.test.pigr = load 'test.txt'
> as (id: chararray, val: long);
>
> t1 = filter r by val >= 12 and val < 20;
> grpd = group t1 by val;
> t1_cnt = foreach grpd generate group as name, COUNT(t1) as value;
> t1_cnt = foreach t1_cnt generate (chararray)name, value;
> grpd = group t1 all;
> t1_cnt_total = foreach grpd generate 't1' as name, COUNT(t1) as value;
>
> t2 = filter r by val >= 20 and val < 30;
> grpd = group t2 by val;
> t2_cnt = foreach grpd generate group as name, COUNT(t2) as value;
> --t2_cnt = foreach t2_cnt generate (chararray)name, value;
> grpd = group t2 all;
> t2_cnt_total = foreach grpd generate 't2' as name, COUNT(t2) as value;
>
> store t1_cnt  into 'outx/3';
> store t2_cnt  into 'outx/4';
> store t1_cnt_total into 'outx/5';
> store t2_cnt_total into 'outx/6';
> andtest.txtc    12
> will cause error:
> Caused by: java.lang.ClassCastException: org.apache.pig.data.BinSedesTuple
> cannot be cast to java.lang.Long
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POCast.getNextString(POCast.java:1167)
> at
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:343)
> ... 14 more
> I don't know why the code need to cast a BinSedesTuple to Long.The same
> exception will be caused if I union the four results.jira link:
> https://issues.apache.org/jira/browse/PIG-4883

Re: Re: exception when use multiple "store"s

Posted by Steve Terrell <st...@oculus360.us>.
I duplicated your problem.  This is just a hunch, but try rewriting the Pig
script without re-using the same alias name repeatedly and see if you get
different results.  (grpd, t1_cnt) .  Since each store trigger a different
MR job (I think), and the MR jobs may run in an uncontrolled order, maybe
Pig is getting confused.  Then reply with the results and the new script.

Thanks,
    Steve

On Thu, May 5, 2016 at 1:38 AM, <li...@sina.com> wrote:

> Thanks a lot.the most minimal input (test.txt) contains one line "c
> 12".You may visit this link (
> https://issues.apache.org/jira/browse/PIG-4883) for a more clear version.
>
> ----- --- -----
> From: Steve Terrell <st...@oculus360.us>
> To:user@pig.apache.org, licstar@sina.com
> Subj: Re: exception when use multiple "store"s
> Date 2016-05-04 23:09
>
> Please provide the the most minimal input (test.txt) required to reproduce
> the error.
> On Wed, May 4, 2016 at 8:28 AM, <li...@sina.com> wrote:
> >  The following code and data will raise an exception.However, if I remove
> > any of the four "store"s, the code will be fine.test.pigr = load
> 'test.txt'
> > as (id: chararray, val: long);
> >
> > t1 = filter r by val >= 12 and val < 20;
> > grpd = group t1 by val;
> > t1_cnt = foreach grpd generate group as name, COUNT(t1) as value;
> > t1_cnt = foreach t1_cnt generate (chararray)name, value;
> > grpd = group t1 all;
> > t1_cnt_total = foreach grpd generate 't1' as name, COUNT(t1) as value;
> >
> > t2 = filter r by val >= 20 and val < 30;
> > grpd = group t2 by val;
> > t2_cnt = foreach grpd generate group as name, COUNT(t2) as value;
> > --t2_cnt = foreach t2_cnt generate (chararray)name, value;
> > grpd = group t2 all;
> > t2_cnt_total = foreach grpd generate 't2' as name, COUNT(t2) as value;
> >
> > store t1_cnt  into 'outx/3';
> > store t2_cnt  into 'outx/4';
> > store t1_cnt_total into 'outx/5';
> > store t2_cnt_total into 'outx/6';
> > andtest.txtc    12
> > will cause error:
> > Caused by: java.lang.ClassCastException:
> org.apache.pig.data.BinSedesTuple
> > cannot be cast to java.lang.Long
> > at
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POCast.getNextString(POCast.java:1167)
> > at
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:343)
> > ... 14 more
> > I don't know why the code need to cast a BinSedesTuple to Long.The same
> > exception will be caused if I union the four results.jira link:
> > https://issues.apache.org/jira/browse/PIG-4883
>