Grokbase Groups Pig user April 2011
FAQ
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

Search Discussions

  • Daniel Dai at Apr 4, 2011 at 5:31 pm
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedApr 4, '11 at 4:39p
activeApr 4, '11 at 5:31p
posts2
users2
websitepig.apache.org

2 users in discussion

Daniel Dai: 1 post William F. Dowling: 1 post

People

Translate

site design / logo © 2022 Grokbase