FOREACH-GENERATE
Tuesday, February 22, 2011
1:18 PM
FOREACH-GENERATE
<alias> = FOREACH <alias2> GENERATE <field expression> [AS <field name>], …; 
Makes <alias> correspond to the output of the specified mapping operation upon <alias2>. 
Mappings can be user-defined Java functions. 
Example: 
clean2 = FOREACH clean1 GENERATE user, time, 
org.apache.pig.tutorial.ToLower(query) as query;
For each record (user,time,query), replace it with a record containing the user, the time, and the lowercase version of the query. 