Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added hadoop version to commands since practically everyone is working with hadoop 2+

...

Install

...

Eclipse

...

Eclipse

...

is

...

an

...

open

...

source

...

development

...

community.

...

If

...

you

...

have

...

not

...

already

...

done

...

so,

...

download

...

and

...

install

...

Eclipse

...

on

...

your

...

development

...

machine.

...

For

...

more

...

information,

...

see

...

Eclipse

...

and

...

Eclipse

...

IDE

...

for

...

Java

...

Developers

...

.

Checkout Pig

Create a directory on your development machine (for example "mypig")

...

and

...

checkout

...

the

...

Pig

...

source

...

from

...

SVN:

...

http://svn.apache.org/repos/asf/pig/trunk

...

Generate

...

eclipse

...

files:

...

ant

...

clean

...

eclipse-files

...

-Dhadoopversion=23

Pre-compile and generate sources

ant compile gen -Dhadoopversion=23

Import Pig project into Eclipse

  1. Open Eclipse
  2. Select File->Import
  3. Select General->Existing Projects Into Workspace
  4. Select root directory (point to <top-level-directory>)

...

  1. Click

...

  1. Finish
  2. Project -> Properties -> Java Build Path -> Source -> Add Folder test/perf/pigmix/src/java
  3. Project -> Properties -> Java Build Path -> Libraries -> Remove javacc-4.2.jar.
  4. Project -> Properties -> Java Build Path -> Libraries -> Add JAR test/perf/pigmix/lib/sdsuLibJKD12.jar.
  5. Project -> Properties -> Java Build Path -> Libraries -> Add External JAR hadoop-yarn-server-applicationhistoryservice-*.jar. (I had to find and download this jar myself. It is needed for running tests.)

Run Pig Main

  1. Create a new Run Configurations
  2. Pick "org.apache.pig.Main"

...

  1. as

...

  1. the

...

  1. Main

...

  1. class

...

Run

...

Pig

...

Unit

...

test

...

  1. Create

...

  1. a

...

  1. new

...

  1. Junit

...

  1. Run

...

  1. Configurations,

...

  1. pick

...

  1. any

...

  1. Pig

...

  1. test

...

  1. suite

...

  1. as

...

  1. "Test

...

  1. class"

...

  1. In

...

  1. "VM

...

  1. arguments",

...

  1. put

...

  1. "-Xmx1024m

...

  1. "
  2. Change "Working directory" into your PIG_HOME
  3. In Classpath, add user entries "$PIG_HOME/build/classes" and "$PIG_HOME/pig*.jar"

Troubleshooting

  • Build problems: Check if eclipse is using JDK version 1.6, pig needs it (Under Preferences/Java/Compiler).
  • If you encounter this error: Missing required library: 'build/ivy/lib/Pig/javacc-4.2.jar' try one of the solutions described in PIG-3399.