1

I am invoking Mapreduce Job from Apache Pig using NaativeMapreduce (https://wiki.apache.org/pig/NativeMapReduce)

MY Question is how to pass it arguments like in command line .

Eg: If I had a Mapreduce Class, whose driver I am invoking from command line and passing it some Arguments which it sets in its job configuration object, like

java MRDriver argument1_value

In MRDriver

public static void main(String[] args) {
   JobConf jobConf = ...
   jobconf.set("argument1",arg[0]);
   .....

 }

The same thing I want to do when I call Mapreduce from Pig

Eg:

  A = load 'WordcountInput.txt';
  B = MAPREDUCE wordcount.jar Store A into 'inputDir' Load 'outputDir' as (word:chararray, count: int) `org.myorg.WordCount inputDir outputDir`;

How can I pass arguments to be set in job conf using Native Mapreduce of Pig.

Kindly ask me in case of more clarification on my question.

Thanks in advance :) cheers!!!

Argho Chatterjee
  • 579
  • 2
  • 9
  • 26

1 Answers1

1

I Got the answer , sharing it in the community so that anyone else can also refer it.

In the below code

X = ... ;
Y = MAPREDUCE 'mymr.jar' [('other.jar', ...)] STORE X INTO 'inputLocation' USING storeFunc LOAD 'outputLocation' USING loadFunc AS schema [`params, ... `];

We can pass the arguments in " [params, ...]" section above

Eg :

Y = MAPREDUCE 'mymr.jar' [('other.jar', ...)] STORE X INTO 'inputLocation' USING storeFunc LOAD 'outputLocation' USING loadFunc AS schema inputpath outpath argument1 argument 2;

here we are passing 3 parameters - inputpath, outpath and argument1

By Default, it picks input from inputpath and dumps output in outputpath

Argho Chatterjee
  • 579
  • 2
  • 9
  • 26