pig tutorial - apache pig tutorial - Apache Pig - Union Operator - pig latin - apache pig - pig hadoop
What is Union Operator in Apache Pig ?
- The UNION operator of Pig Latin is used to merge the content of two relations.
- To perform UNION operation on two relations, their columns and domains must be identical.
- Joins in the same relation multiple relations
The syntax of the UNION operator is
Ensure that we have two files namely wikitechy_employee_data1.txt and wikitechy_employee_data2.txt in the /pig_data/ directory of HDFS as shown below.
And we have loaded these two files into Pig with the relations employee1 and employee2 as shown below.
Now merge the contents of these two relations using the UNION operator as given below.
Now verify the relation employee using the DUMP operator as given below.
The following output, displaying the contents of the relation employee.