I am seeing something weird with running Pig embedded in Java. Basically
the script exits without any information. Here are the steps I am following:

pkommireddi@pkommireddi-wsl:~/misc/pig$ echo $HADOOPDIR
/home/pkommireddi/dev/apps/gridforce/main/hadoop/conf/gus
pkommireddi@pkommireddi-wsl:~/misc/pig$ date
Wed Dec  7 14:19:15 PST 2011
pkommireddi@pkommireddi-wsl:~/misc/pig$ javac -cp
/home/pkommireddi/gridforce_ws/hadoop-test/lib/pig-0.9.1.jar
idmapreduce.java
pkommireddi@pkommireddi-wsl:~/misc/pig$ ls -l idmapreduce.class
-rw-r--r-- 1 pkommireddi pkommireddi 1054 2011-12-07 14:19 idmapreduce.class
pkommireddi@pkommireddi-wsl:~/misc/pig$ java -cp
/home/pkommireddi/gridforce_ws/hadoop-test/lib/pig-0.9.1.jar:.:$HADOOPDIR
idmapreduce
11/12/07 14:19:31 INFO executionengine.HExecutionEngine: Connecting to
hadoop file system at: hdfs://xyz.net:54310
11/12/07 14:19:31 INFO executionengine.HExecutionEngine: Connecting to
map-reduce job tracker at: xyz.net:54311
11/12/07 14:19:31 INFO pigstats.ScriptState: Pig features used in the
script: UNKNOWN
pkommireddi@pkommireddi-wsl:~/misc/pig$

I don't see the job running on JT, seems like it prints the first couple
INFO lines and then exits. What could the problem be here?

Here is the code, from
http://pig.apache.org/docs/r0.9.1/cont.html#embed-java

import java.io.IOException;

import org.apache.pig.PigServer;

public class idmapreduce{
   public static void main(String[] args) {
   try {
     PigServer pigServer = new PigServer("mapreduce");
     runIdQuery(pigServer, "passwd");
   }
   catch(Exception e) {
   }
}
public static void runIdQuery(PigServer pigServer, String inputFile) throws
IOException {
   pigServer.registerQuery("A = load '" + inputFile + "' using
PigStorage(':');");
   pigServer.registerQuery("B = foreach A generate $0 as id;");
   pigServer.store("B", "idout");
   }
}

Thanks,

Reply via email to