Database Reference
In-Depth Information
Category
Expressions
Description
Examples
Boolean
Logical OR
x OR y
q == 0 OR q == 1
Logical AND
x AND y
q == 0 AND r == 0
Logical negation
NOT x
NOT q matches
'[01459]'
Set membership
IN x
q IN (0, 1, 4, 5, 9)
Functional
fn ( f1 , f2 ,...) Invocation of function fn on fields f1 ,
f2 , etc.
isGood(quality)
Flatten
Removal of a level of nesting from
bags and tuples
FLATTEN( f )
FLATTEN(group)
Types
So far you have seen some of the simple types in Pig, such as int and chararray .
Here we will discuss Pig's built-in types in more detail.
Pig has a boolean type and six numeric types: int , long , float , double , bigin-
teger , and bigdecimal , which are identical to their Java counterparts. There is also a
bytearray type, like Java's byte array type for representing a blob of binary data, and
chararray , which, like java.lang.String , represents textual data in UTF-16
format (although it can be loaded or stored in UTF-8 format). The datetime type is for
storing a date and time with millisecond precision and including a time zone.
Pig does not have types corresponding to Java's byte , short , or char primitive types.
These are all easily represented using Pig's int type, or chararray for char .
The Boolean, numeric, textual, binary, and temporal types are simple atomic types. Pig
Latin also has three complex types for representing nested structures: tuple , bag , and
map . All of Pig Latin's types are listed in Table 16-6 .
Search WWH ::




Custom Search