Javatpoint Logo
Javatpoint Logo

Apache Pig CROSS Operator

The Apache Pig CROSS operator facilitates to compute the cross product of two or more relations. Using CROSS operator is an expensive operation and should be used sparingly.

Example of CROSS Operator

In this example, we compute the data of two relations.

Steps to execute CROSS Operator

  • Create a text file in your local machine and write some values into it.
Apache Pig CROSS Operator
  • Create another text file in your local machine and also write some values into it.
Apache Pig CROSS Operator
  • Check the values written in both text files.
Apache Pig CROSS Operator
  • 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 Cartesian product between both files.
  • Now, execute and verify the data.
Apache Pig CROSS Operator

Here, we got the desired output.

Next TopicDISTINCT Operator





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA