You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "William F. Dowling" <wi...@thomsonreuters.com> on 2011/04/04 18:38:34 UTC
pig 0.8 : examples in cookbook; quoting key names in map
dereferences
I am a new pig and hadoop user, working my way through some simple
examples in http://pig.apache.org/docs/r0.8.0/cookbook.html
In the section "Reduce Your Operator Pipeline" of the cookbook, are
these examples:
A = load 'data' as (in: map[]);
-- get key out of the map
B = foreach A generate in#k1 as k1, in#k2 as k2;
[...]
B = foreach A generate CONCAT(in#k1, in#k2);
When I tried running those I get messages like this:
grunt> B = foreach A generate in#k1 as k1, in#k2 as k2;
2011-04-04 12:27:36,525 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Encountered " <IDENTIFIER> "k1 "" at line 1, column 27.
Was expecting one of:
"null" ...
<QUOTEDSTRING> ...
<QUOTEDSTRING> ...
"null" ...
Quoting the key name seems to work:
grunt> B = foreach A generate in#'k1' as k1, in#'k2' as k2;
I'm mentioning this in case other newbies run into the same thing, or if the cookbook is being maintained.
BTW Thanks to the Pig developers! It's a great tool.
William F Dowling
ThomsonReuters
Re: pig 0.8 : examples in cookbook; quoting key names in map dereferences
Posted by Daniel Dai <ji...@yahoo-inc.com>.
Thanks for reporting. Opened
https://issues.apache.org/jira/browse/PIG-1960 for that.
Daniel
On 04/04/2011 09:38 AM, William F. Dowling wrote:
> I am a new pig and hadoop user, working my way through some simple
> examples in http://pig.apache.org/docs/r0.8.0/cookbook.html
>
> In the section "Reduce Your Operator Pipeline" of the cookbook, are
> these examples:
> A = load 'data' as (in: map[]);
> -- get key out of the map
> B = foreach A generate in#k1 as k1, in#k2 as k2;
> [...]
> B = foreach A generate CONCAT(in#k1, in#k2);
>
> When I tried running those I get messages like this:
>
> grunt> B = foreach A generate in#k1 as k1, in#k2 as k2;
> 2011-04-04 12:27:36,525 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during parsing. Encountered "<IDENTIFIER> "k1 "" at line 1, column 27.
> Was expecting one of:
> "null" ...
> <QUOTEDSTRING> ...
> <QUOTEDSTRING> ...
> "null" ...
>
>
> Quoting the key name seems to work:
>
> grunt> B = foreach A generate in#'k1' as k1, in#'k2' as k2;
>
> I'm mentioning this in case other newbies run into the same thing, or if the cookbook is being maintained.
>
> BTW Thanks to the Pig developers! It's a great tool.
>
> William F Dowling
> ThomsonReuters
>
>