Pig Latin – Data types
Given below table describes the Pig Latin data types.
S.N. | Data Type | Description | & | Example |
---|---|---|---|---|
1 | int | Represents a signed 32-bit integer.Example: 8 | ||
2 | long | Represents a signed 64-bit integer.Example: 5L | ||
3 | float | Represents a signed 32-bit floating point.Example: 5.5F | ||
4 | double | Represents a 64-bit floating point.Example: 10.5 | ||
5 | chararray | Represents a character array (string) in Unicode UTF-8 format.Example: ‘tutorials point’ | ||
6 | Bytearray | Represents a Byte array (blob). | ||
7 | Boolean | Represents a Boolean value.Example: true/ false. | ||
8 | Datetime | Represents a date-time.Example: 1970-01-01T00:00:00.000+00:00 | ||
9 | Biginteger | Represents a Java BigInteger.Example: 60708090709 | ||
10 | Bigdecimal | Represents a Java BigDecimalExample: 185.98376256272893883 | ||
Complex Types | ||||
11 | Tuple | A tuple is an ordered set of fields.Example: (raja, 30) | ||
12 | Bag | A bag is a collection of tuples.Example: {(raju,30),(Mohhammad,45)} | ||
13 | Map | A Map is a set of key-value pairs.Example: [ ‘name’#’Raju’, ‘age’#30] |
Null Values
Values for all the above data types can be NULL. Apache Pig treats null values in a similar way as SQL does.
A null can be an unknown value or a non-existent value. It is used as a placeholder for optional values. These nulls can occur naturally or can be the result of an operation.