pig tutorial - apache pig tutorial - Apache Pig TOMAP() - pig latin - apache pig - pig hadoop
What is TOMAP() function in Apache Pig ?
- The TOMAP() function is used to converts key/value expression pairs into a map.
- Needs an even number of expressions as parameters.
- The elements must comply with map type rules.
Learn apache pig - apache pig tutorial - apache pig tomap() - apache pig examples - apache pig programs
Syntax
Example
- Ensure that we have a file named wikitechy_emp_details.txt in the HDFS directory /pig_data/, as given below.
Wikitechy_emp_details.txt
- You have loaded this file into Pig with the relation name emp_data as given below.
- · You can take the name and age of each record as key-value pairs and convert them into map as given below.
Verification
- · Now you can verify the contents of the tomap relation using the Dump operator as given below.
Output
- The above statement stores the result in the relation named emp_data.