pig-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Atul Raut <rautatu...@gmail.com>
Subject How to execute pig script from java
Date Mon, 30 Jul 2018 03:24:25 GMT
How to execute pig script from java class.

I need to submit Pig script from my java application to the Pig server
(This may be on any remote location) and that Pig server will execute that
script and return the result to my java application.

Following is my source,

public static void main(String[] args) throws Exception
{ System.setProperty("hadoop.home.dir",
"/Pig/hadoop-common-2.2.0-bin-master/"); Properties props = new
Properties(); props.setProperty("fs.default.name", "hdfs://"); props.setProperty("mapred.job.tracker", "");
props.setProperty("pig.use.overriden.hadoop.configs", "true"); PigServer
pig = new PigServer(ExecType.MAPREDUCE, props); pig.debugOn();
pig.registerScript("A = LOAD '/apps/employee/sample.txt' USING
PigStorage();"); }

Atul Raut

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message