DeejUK
DeejUK

Reputation: 13471

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.

Upvotes: 3

Views: 2421

Answers (3)

NerdyNick
NerdyNick

Reputation: 803

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

Upvotes: 2

Costin Leau
Costin Leau

Reputation: 26

See Spring Hadoop project and its Pig support.

Upvotes: 1

ndeverge
ndeverge

Reputation: 21564

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.

Upvotes: 2

Related Questions