Home » Apache Pig SPLIT Operator

Apache Pig SPLIT Operator

by Online Tutorials Library

Apache Pig SPLIT Operator

The Apache Pig SPLIT operator breaks the relation into two or more relations according to the provided expression. Here, a tuple may or may not be assigned to one or more than one relation.

Example of SPLIT Operator

In this example, we split the provided relation into two relations.

Steps to execute SPLIT Operator

  • Create a text file in your local machine and provide some values to it.

Apache Pig SPLIT Operator

  • Check the values written in the text files.

Apache Pig SPLIT Operator

  • Upload the 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.

Apache Pig SPLIT Operator

  • Let’s provide the expression to split the relation.

Apache Pig SPLIT Operator

  • Now, execute and verify the data of the first relation.

Apache Pig SPLIT Operator

  • Now, execute and verify the data of the second relation.

Apache Pig SPLIT Operator

Here, we got the desired output.

Next TopicUNION Operator

You may also like