Pig has three complex data types, which are primarily Tuple, Bag, and Map.
Tuple : A tuple is an ordered set of fields that can contain different data types for each field. It is represented by braces ()
.
Example : (1,3)
Bag : A bag is a set of tuples represented by curly braces {}
.
Example : {(1,4), (3,5), (4,6)}
Map : A map is a set of key-value pairs used to represent data elements. It is represented in square brackets [ ]
.
Example : [key#value, key1#value1,….]