Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Pig Wiki" for change 
notification.

The following page has been changed by OlgaN:
http://wiki.apache.org/pig/PigLatin

------------------------------------------------------------------------------
  || Map Lookup against another data item || f3#'apache' || Data Atom 'pig' || 
User's responsibility to ensure that a lookup is written only against a  data 
map, otherwise a runtime error is thrown. If the key being looked up does not 
exist, a Data Atom with an empty string is returned ||
  || Function applied to another data item || SUM(f2.$0) || 2+4+5 = 11 || SUM 
is a builtin Pig function. See PigFunctions for how to write your own functions 
||
  || Infix Expression of other data items || COUNT(f2) + f1 / '2.0' || 3 + 1 / 
2.0 = 3.5 || ||
+ || Bincond, i.e., the value of the data item is chosen according to some 
condition ||(f1 = =  '1' ? '2' : COUNT(f2))|| '2' since f1=='1' is true. If f1 
were != '1', then the value of this data item for t would be COUNT(f2)=3 || See 
[#CondS Conditions] for what the format of the condition in the bincond can be 
||
  
+ == Pig Latin Statements ==
+ 
+ A Pig Latin statement is a command that produces a '''Relation'''. A relation 
is simply a data bag with a name. That name is called the relation's 
'''alias'''. The simplest Pig Latin statement is LOAD, which reads a relation 
from a file in the file system. Other Pig Latin statements process one or more 
input relations, and produce a new relation as a result.
+ 
+ Pig commands can span multiple lines and must include ";" at the end.
+ 
+ Examples:
+ 
+ `grunt> A = load 'data' using PigStorage() as (x, y, z);`
+ `grunt>B = group A by x;`
+ `grunt> C = foreach B {`
+ 
+ `D = distinct A.y;`
+ 
+ `generate flatten(group), COUNT(D);`
+ 
+ `}`
+ `grunt>` 
+ 

Reply via email to