Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.

Mapper and reducer accessing a shared variable/value ?

Mapper and reducer accessing a shared variable/value ?

New Contributor

How to share a common variable/value between jobclient, map and reducer ?

 

I am doing a matrix multiplcation in map reduce. I would like both mapper and reducer to know the size of the matrix they are handling. Which is the best way a mapper and reducer can access such common values ?

 

thanks,

Jithesh

1 REPLY 1

Re: Mapper and reducer accessing a shared variable/value ?

New Contributor

// Job Client..

 
Configuration conf = new Configuration();
conf.set("dimension", "5"); // set the matrix dimension here.
 
// mapper
 
Configuration conf = context.getConfiguration();
String dimension = conf.get("dimension");
 
Or use Dist Cache..