Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Master Mentor

As I was reading over Pig mailing lists, I found a plugin that allows one to turn Eclipse IDE into a Pig editor. There are alternatives like Ambari Pig view and Hue but if you're comfortable using an IDE, then you will feel right at home with this plugin. Setup is fairly straightforward and surprisingly supports Pig from 0.11 to 0.16, which means you can even use it with the latest HDP 2.5 release! The best part, I didn't need to start a Sandbox, download a binary distribution of Pig or mess with any config files, once plugin is installed you can start scripting as if you were working on a cluster. It is still work in progress but feature list is impressive nonetheless. It supports the following features as of 9/13/16:

  • supports Apache Pig Latin 0.11 - 0.16
  • syntax highlighting
  • open declaration (F3) - for macros, defines, and UDF's
  • auto complete (ctrl+space) - defines, relations, reserved words, built in functions
  • toggle comment (ctrl+shift+c) - to comment/uncomment a block using --
  • find references (ctrl+shift+g) - preliminary implementation, to find usages of macros
  • hover information (tooltips) for macro definitions, UDF's and built in functions (javadocs) and some keywords
  • preferences page for colors, Pig version, auto complete behavior and more

I will explore some of the features in this article.

I guess the one limitation I've found is that it's tested with older versions of Eclipse with latest being Luna. I am running this demo with Luna to avoid any unforeseen issues.

First thing we need to do is go to Help > Install New Software, give the plugin a name and enter URL http://github.com/eyala/pig-eclipse-update-site/raw/master

7693-1a.jpg

Select the Pig-Eclipse plugin and hit Next

7694-2a.jpg

Eclipse will fetch the bits

7695-3a.jpg

Accept the EULA and hit Finish

7696-4a.jpg

At this point we can create a new project in a typical Eclipse fashion and start writing Pig scripts

7697-5a.jpg

Saving Pig scripts with .pig extension identifies them automatically, you can change the behavior in preferences section

7698-6a.jpg

Let's see code completion, you invoke it with ctrl+space

7699-7a.jpg

7700-8a.jpg

You can toggle comment with ctrl+shft+c

7711-10a.jpg

and you can change preferences for theme and colors as well as behavior based on Pig version

7712-11a.jpg

This of course is not meant to be an exhaustive deep-dive into Pig-Eclipse but something to get you started. Overall, it's an interesting project that I'll be spending more time with, the convenience, ease-of-use and independence from Sandbox are all of the benefits of using this plugin over other alternatives. I thank the author for his contribution. Here's the project GitHub page.

4,800 Views
Comments
avatar
New Contributor

Hi currently I am using eclipse jee neon IDE and i have configured apache Pig with it. Based upon the instructions i have created hadoop file system and uploaded some data files into it. I have also written a Pig script to run some codes. But i am unable to run the script as its showing an exception 'unable to launch'. Please suggest any workaround to fix this issue. Below is the snapshot of the same.pig-eclipse.png