Pig: Install and Rebuild

ENV:  Hadoop2.3.0  pig0.12

Hadoop is runnig and pig grunt works well.

but when load data and dump it to screen

#actor = load '/test/actor' using PigStorage(',') as (id, name, addr, time);

#dump actor;

the error is :

ackend error message during job submission
-------------------------------------------
Unexpected System Error Occured: java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but cl
ass was expected
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat.setupUdfEnvAndStores(PigOutputFormat.java:225)
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigOutputFormat.checkOutputSpecs(PigOutputFormat.java:186)
    at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:458)
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:343)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1285)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1282)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1282)
    at org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.submit(ControlledJob.java:335)
    at org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl.run(JobControl.java:240)
    at org.apache.pig.backend.hadoop20.PigJobControl.run(PigJobControl.java:121)
    at java.lang.Thread.run(Thread.java:744)
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher$1.run(MapReduceLauncher.java:270)

Pig Stack Trace
---------------
ERROR 1066: Unable to open iterator for alias actor

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias actor
    at org.apache.pig.PigServer.openIterator(PigServer.java:880)
    at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:774)
    at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:372)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:198)
    at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:173)
    at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:69)
    at org.apache.pig.Main.run(Main.java:541)
    at org.apache.pig.Main.main(Main.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Caused by: java.io.IOException: Job terminated with anomalous status FAILED
    at org.apache.pig.PigServer.openIterator(PigServer.java:872)
    ... 12 more

 

cause: version imcomparable

http://stackoverflow.com/questions/21300612/error-in-pig-while-loading-data

 http://blog.csdn.net/u011569805/article/details/17174131

solution: recompile

    (1) cd /${PIG_HOME}

    (2) mv pig-0.10.1-withouthadoop.jar pig-0.10.1-withouthadoop.jar.bak

    (3) mv pig-0.10.1.jar pig-0.10.1.jar.bak

    (4) ant clean jar-withouthadoop -Dhadoopversion=23

    编译完成后将在${PIG_HOME}/build目录下生成:

    pig-0.12.0-SNAPSHOT-core.jar, pig-0.12.0-SNAPSHOT-withouthadoop.jar

    (5) 将上一步生成的两个文件Copy至${PIG_HOME}下,并进行改名:

    pig-0.12.0-SNAPSHOT-core.jar  --> pig-0.12.0.jar

    pig-0.12.0-SNAPSHOT-withouthadoop.jar -->  pig-0.12.0-withouthadoop.jar

 

Note: the best source to learn pig is the book 'Programming Pig'.  Download the sample code and data

by following steps:

1.install git by #sudo apt-get install git

2.clone project form git by #git clone https://github.com/alanfgates/programmingpig.git  /path/to/destinationdir

你可能感兴趣的:(Install)