Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute Pig from within Java Application

Is it possible to run Apache Pig jobs from within a Java application, without forking an external process?

It seems both Pig and Hadoop are written in Java but don't really offer Java APIs. Rather than relying on shell scripts, I'd rather use these tools form within a Java Spring application.

like image 633
EngineerBetter_DJ Avatar asked Sep 04 '26 18:09

EngineerBetter_DJ


2 Answers

It seems there is Java API for Pig.

According to this API, there is a PigRunner class.

With that, you could easily add it to your Spring application, by creating a dedicated Spring bean.

like image 67
ndeverge Avatar answered Sep 07 '26 10:09

ndeverge


From what I've seen document wise and example wise is to you the PigServer class. They have examples of using it here: http://pig.apache.org/docs/r0.8.1/setup.html#Sample+Code

like image 40
NerdyNick Avatar answered Sep 07 '26 09:09

NerdyNick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!