You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by Jonathan Coveney <jc...@gmail.com> on 2012/06/20 06:57:45 UTC

A solution for the confusion around "as alias:type" ?

I cannot tell you the number of scripts I have had die because of this, and
the mass confusion it causes. Is there any reason why we can't just have

"thing as alias:type" and "(type)thing as alias" be synonymous?

Re: A solution for the confusion around "as alias:type" ?

Posted by Aniket Mokashi <an...@gmail.com>.
Thanks for sharing. Good to know about this... Huh! I know a bunch of
confused users already. I should let them know soon.

~Aniket

On Wed, Jun 20, 2012 at 2:35 AM, Gianmarco De Francisci Morales <
gdfm@apache.org> wrote:

> We have already discussed it and come to a decision:
> See https://issues.apache.org/jira/browse/PIG-2315
> If somebody feels like implementing it I would be happy :)
>
> Cheers,
>
> --
> Gianmarco
>
>
>
>
> On Wed, Jun 20, 2012 at 7:36 AM, Jonathan Coveney <jcoveney@gmail.com
> >wrote:
>
> > $ cat data6
> > 1
> > 2
> > 3
> > 4
> > 5
> >
> > $ java -cp pig.jar org.apache.pig.Main -x local
> > a = load 'data6' as (x:chararray);
> > b = foreach a generate x as y:int;
> > c = foreach b generate y+y;
> > dump c;
> >
> > Eventually:
> > java.lang.ClassCastException: java.lang.String cannot be cast to
> > java.lang.Number
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.Add.genericGetNext(Add.java:89)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.Add.getNext(Add.java:114)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:344)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:353)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:294)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.runPipeline(PigGenericMapBase.java:273)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:268)
> > at
> >
> >
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:64)
> > at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
> > at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
> > at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
> > at
> org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:212)
> >
> >
> > 2012/6/19 Aniket Mokashi <an...@gmail.com>
> >
> > > I am not aware of the difference, can you please elaborate? That would
> > help
> > > other users too [+user@pig?]...
> > >
> > > Thanks,
> > > Aniket
> > >
> > > On Tue, Jun 19, 2012 at 9:57 PM, Jonathan Coveney <jcoveney@gmail.com
> > > >wrote:
> > >
> > > > I cannot tell you the number of scripts I have had die because of
> this,
> > > and
> > > > the mass confusion it causes. Is there any reason why we can't just
> > have
> > > >
> > > > "thing as alias:type" and "(type)thing as alias" be synonymous?
> > > >
> > >
> > >
> > >
> > > --
> > > "...:::Aniket:::... Quetzalco@tl"
> > >
> >
>



-- 
"...:::Aniket:::... Quetzalco@tl"

Re: A solution for the confusion around "as alias:type" ?

Posted by Gianmarco De Francisci Morales <gd...@apache.org>.
We have already discussed it and come to a decision:
See https://issues.apache.org/jira/browse/PIG-2315
If somebody feels like implementing it I would be happy :)

Cheers,

--
Gianmarco




On Wed, Jun 20, 2012 at 7:36 AM, Jonathan Coveney <jc...@gmail.com>wrote:

> $ cat data6
> 1
> 2
> 3
> 4
> 5
>
> $ java -cp pig.jar org.apache.pig.Main -x local
> a = load 'data6' as (x:chararray);
> b = foreach a generate x as y:int;
> c = foreach b generate y+y;
> dump c;
>
> Eventually:
> java.lang.ClassCastException: java.lang.String cannot be cast to
> java.lang.Number
> at
>
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.Add.genericGetNext(Add.java:89)
> at
>
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.Add.getNext(Add.java:114)
> at
>
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:344)
> at
>
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:353)
> at
>
> org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:294)
> at
>
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.runPipeline(PigGenericMapBase.java:273)
> at
>
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:268)
> at
>
> org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:64)
> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
> at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:212)
>
>
> 2012/6/19 Aniket Mokashi <an...@gmail.com>
>
> > I am not aware of the difference, can you please elaborate? That would
> help
> > other users too [+user@pig?]...
> >
> > Thanks,
> > Aniket
> >
> > On Tue, Jun 19, 2012 at 9:57 PM, Jonathan Coveney <jcoveney@gmail.com
> > >wrote:
> >
> > > I cannot tell you the number of scripts I have had die because of this,
> > and
> > > the mass confusion it causes. Is there any reason why we can't just
> have
> > >
> > > "thing as alias:type" and "(type)thing as alias" be synonymous?
> > >
> >
> >
> >
> > --
> > "...:::Aniket:::... Quetzalco@tl"
> >
>

Re: A solution for the confusion around "as alias:type" ?

Posted by Jonathan Coveney <jc...@gmail.com>.
$ cat data6
1
2
3
4
5

$ java -cp pig.jar org.apache.pig.Main -x local
a = load 'data6' as (x:chararray);
b = foreach a generate x as y:int;
c = foreach b generate y+y;
dump c;

Eventually:
java.lang.ClassCastException: java.lang.String cannot be cast to
java.lang.Number
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.Add.genericGetNext(Add.java:89)
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.Add.getNext(Add.java:114)
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.getNext(PhysicalOperator.java:344)
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.processPlan(POForEach.java:353)
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POForEach.getNext(POForEach.java:294)
at
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.runPipeline(PigGenericMapBase.java:273)
at
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:268)
at
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigGenericMapBase.map(PigGenericMapBase.java:64)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:212)


2012/6/19 Aniket Mokashi <an...@gmail.com>

> I am not aware of the difference, can you please elaborate? That would help
> other users too [+user@pig?]...
>
> Thanks,
> Aniket
>
> On Tue, Jun 19, 2012 at 9:57 PM, Jonathan Coveney <jcoveney@gmail.com
> >wrote:
>
> > I cannot tell you the number of scripts I have had die because of this,
> and
> > the mass confusion it causes. Is there any reason why we can't just have
> >
> > "thing as alias:type" and "(type)thing as alias" be synonymous?
> >
>
>
>
> --
> "...:::Aniket:::... Quetzalco@tl"
>

Re: A solution for the confusion around "as alias:type" ?

Posted by Aniket Mokashi <an...@gmail.com>.
I am not aware of the difference, can you please elaborate? That would help
other users too [+user@pig?]...

Thanks,
Aniket

On Tue, Jun 19, 2012 at 9:57 PM, Jonathan Coveney <jc...@gmail.com>wrote:

> I cannot tell you the number of scripts I have had die because of this, and
> the mass confusion it causes. Is there any reason why we can't just have
>
> "thing as alias:type" and "(type)thing as alias" be synonymous?
>



-- 
"...:::Aniket:::... Quetzalco@tl"