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
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:
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