Apache Pig cross example
1) A machine with Ubuntu 14.04 LTS operating system
2) Apache Hadoop 2.6.4 pre installed (How to install Hadoop on Ubuntu 14.04)
3) Apache Pig pre installed (How to install Pig on Ubuntu 14.04)
Pig Cross Example
The cross operator computes the cross-product of two or more relations. This chapter explains with example how to use the cross operator in Pig Latin.
Step 1 - Change the directory to /usr/local/pig/bin
Step 2 - Enter into grunt shell in MapReduce mode.
Step 3 - Create a customers.txt file.
Step 4 - Add these following lines to customers.txt file.
Step 5 - Create a orders.txt file.
Step 6 - Add these following lines to orders.txt file.
Step 7 - Copy customers.txt and orders.txt from local file system to HDFS. In my case, the customers.txt and orders.txt file are stored in /home/hduser/Desktop/PIG/ directory.
Step 8 - Load customers data.
Step 9 - Load orders data.
Step 10 - Cross data.
Please share this blog post and follow me for latest updates on
Labels : Pig Installation Pig Execution Mechanism Pig GRUNT Shell Usage Pig Load and Store Operations Pig Diagnostic Operators Pig Group Example Pig Join Example Pig Union Example Pig Split Example Pig Filter Example Pig Distinct Example Pig Foreach Example Pig OrderBy Example Limit Example Pig Eval Functions Example Pig BagToString Example Pig Concat Example Pig Tokenize Example Pig UDF's Java Example Pig SCRIPT