All posts tagged: Pig

How to add numbers with Pig

Leave a comment
Hadoop

Introduction We’re going to start with a very simple Pig script that reads a file that contains 2 numbers per line separated by a comma. The Pig script will first read the line, store each of the 2 numbers in separate variables, and will then add the numbers together. Create the Sample Input File cd vi pig-practice01.txt Paste the following into pig-practice01.txt. 5 1 6 4 3 2 1 1 9 2 3 8 Create […]

Install Pig 0.9.2 for CDH4 on Ubuntu 12.04 LTS x64

Leave a comment
Hadoop

Introduction Installing Pig is drop dead simple. Installation sudo apt-get install pig Check the Pig version. pig --version Setup the Environment We’re going to set the environment variables system-wide for Pig programming. sudo vi /etc/environment Paste the following environment variables into the environment file. HADOOP_MAPRED_HOME="/usr/lib/hadoop-mapreduce" PIG_CONF_DIR="/etc/pig/conf" source /etc/environment That’s it. You can now start to write and run pig jobs.