Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> error to generate a map?


Copy link to this message
-
Re: error to generate a map?
Maps require string keys.  So it should read ['222'#1].

Alan.

On Jun 7, 2012, at 8:51 PM, Yang wrote:

> I ran the following simple pig script
>
>
> a = load 'a';
>
> b = foreach a generate [222#1];
>
> dump b;
>
>
> but it gave the following error
>
> $ pig -x local  a.pig
> 2012-06-07 20:49:13,039 [main] INFO  org.apache.pig.Main - Logging error
> messages to:
> /crypt/yyang_home/work/matching/ML-places-matcher/control_flows/match_suspects/pig_1339127353036.log
> 2012-06-07 20:49:13,168 [main] INFO
> org.apache.pig.backend.hadoop.executionengine.HExecutionEngine -
> Connecting to hadoop file system at: file:///
> 2012-06-07 20:49:13,692 [main] ERROR org.apache.pig.tools.grunt.Grunt -
> ERROR 1200: <file a.pig, line 3, column 23>  Syntax error, unexpected
> symbol at or near '['
>
>
>
> but this script is basically the same as the one copied from manual:
> http://pig.apache.org/docs/r0.9.2/basic.html
>
> A = LOAD 'data' USING MyStorage() AS (T: tuple(name:chararray, age: int));
> B = FILTER A BY T == ('john', 25);
> D = FOREACH B GENERATE T.name, [25#5.6], {(1, 5, 18)};
>
>
>
> how could I fix it?
>
>
>
> thanks!
>
> yang