Database Reference
In-Depth Information
Data Types
Data types supported by Pig can be categorized as simple data types and complex data
types.
Simple Data Types
Simple data types, such as String, int, and so on, are those generally available with
most databases and are most often used. Table 6-1 shows all the simple data types sup-
ported by Pig.
Table 6-1 . Pig-Supported Simple Data Types
Data type
Description
charArray
UTF-8 encoded string (e.g., Cassandra)
ByteArray
Byte array (blob)
Double
64-bit precision format (e.g., 11.9)
Float
32-bit precision format (e.g., 10.2f)
Int
32-bit signed integer (e.g., 100)
Long
64-bit signed integer (e.g., 50L)
Complex Data Types
Complex data types, such as map which holds the key-value pair, prefer some kind of
predefined data structure format. Table 6-2 shows all three complex data types suppor-
ted by Pig.
Table 6-2 . Pi- Supported Complex Data Types
Data
Type
Description
Tuples
A tuple is an ordered set of data. A tuple can be thought of as a row with multiple fields and these fields can be of any type and may or
may not have data. Tuples are enclosed with ().
For example, (Vivek,Apress,6) depicts a tuple having author name, publishing house, and chapter number fields.
Bags
A bag is a collection of tuples. A bag can have duplicate tuples and each tuple may differ in the number of fields and their data types.
For example, this is a bag with multiple tuples:
 
 
 
 
Search WWH ::




Custom Search