114
Apache Pig UNION Operator
The Apache Pig UNION operator is used to compute the union of two or more relations. It doesn’t maintain the order of tuples. It also doesn’t eliminate the duplicate tuples.
Example of UNION Operator
In this example, we compute the data of two relations.
Steps to execute UNION Operator
- Create a text file in your local machine and write some values into it.
- Create another text file in your local machine and also write some values into it.
- Check the values written in both text files.
- Upload both text files on HDFS in the specific directory.
- Open the pig MapReduce run mode.
- Load the file that contains the data.
- Now, execute and verify the data.
- Load the another file that contains the data.
- Now, execute and verify the data.
- Let’s perform the union operation between both files.
- Now, execute and verify the data.
Here, we got the desired output.
Next TopicAVG Function