PigPen is an eclipse plugin that helps users create pig-scripts, test them using the example generator and then submit them to a hadoop cluster as well.
The PigPen plugin jar can be obtained from here.
The jar can be placed in the eclipse/plugins/ folder. It is a good idea to start eclipse with a "-clean" option to ensure that the latest version of the plugins is being used.
To start using PigPen you will have to set the path to the directory containing both hadoop-site.xml and pig.properties for the plugin to connect to the cluster. This can be done by going to Eclipse preferences -> Pig and adding a new variable *ConfigurationPath* to the JobConf properties.
Diagram 1 : Setting the ConfigurationPath
1. Create a new "General" Project in eclipse. 2. Add a new file to the project. Make sure the file has an extension ".pig". 3. This should start the Pig editor with the new empty file. PigPen has 3 editors. The *Operator Graph* shows you the query in a graph form. The *Header* is to be used with the Operator Graph for registering jars or giving define directives. The *Pig Script* is the text editor. The figure below shows the PigPen editor.
Diagram 2 : PigPen editor
4. Currently the script can only be edited using the *Pig Script* text editor. The synchronization between the graph and the text editor happens when you save the script. So its a good idea to save the changes in the text editor before switching views.
The following screenshots show the usage of the *Pig Script* editor.
Diagram 3 : Sample Script
Diagram 4 : Operator Graph
Running the Example Generator
Once the script is error-free, you can run the example generator by clicking on the Pig icon in the toolbar. Once satisfied with the results, you can submit the script to the cluster by clicking on the Hadoop icon.
Diagram 5 : Pig and Hadoop icons are the 4th and 5th from left.
The following diagram shows the Pig Examples window
Diagram 6 : Output of the Example Generator