LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PIG SERVER or PIG programming (https://www.linuxquestions.org/questions/programming-9/pig-server-or-pig-programming-930808/)

chaitanyakumar1988 02-23-2012 12:14 AM

PIG SERVER or PIG programming
 
Sorry , i didn't know where to post this but wanted to help people working with PIG for the first time .(As i struggled for a long time to run my first program)
Anyways , please follow the steps to run pig programs via java .

1.write ur program in java as
PigServer pigServer = new PigServer("local"); // here local indicates u run ur prog in local mode, mapreduce indicates u run the prog in cluster mode .
2. register ur queries as
pigServer.registerQuery(<ur queries go here>);
3. run ur queries using
pigServer.store(<whatever u wana store >,<path>);

Now for runnig ur program

javac -cp <locate ur pig jar here> <ur programname>.java

If this doesnt work.. Set the CLASSPATH using export CLASSPATH to point to PIG jar and then run

javac <ur programname>.java

Lastly just run
java <ur programname>.java

and see the output in the path u have specified(local) or in base folder or path specified (mapreduce mode)

Hope people find this useful.:)

sundialsvcs 02-23-2012 05:17 PM

Any pig that winds up in a jar around my place is gonna be named: bacon.


All times are GMT -5. The time now is 01:12 PM.