Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # user >> Get dynamic values in a user defined class from reducer.


Copy link to this message
-
Get dynamic values in a user defined class from reducer.
Can any one pls suggest a good way
My scenario:
i hav
1.Driver class
2.Mapper class
3.reducer class
4.Mid class
After completing mapper it goes to reduce. From reducer it will be going
to Driver and from driver to Mid class

so i need to get a data from reducer class to Mid class
 So for that i declared a static variable in reduce and tried to access
that variable in Mid class.But while executing i am only getting the 0
value. How to overcome this.
Reducer.java
--------------------
public  class Reduce extends MapReduceBase
implements Reducer<Text, IntWritable, Text, IntWritable> {
int ig;
public void reduce(Text key, Iterator<IntWritable> values,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
                              ig = 9;
}
}
Driver.java
       gainObj.getcount();
Mid.java
public class Mid{
public void getcount(String args) throws IOException
{
                   //WANT TO GET THE IG VALUE IE "9" HERE So i did like this
                        Reduce r = new Reduce();
System.out.println("red "+ r.ig);
}
}
But my result is "0". Not 9.
How to solve this?
--
*Thanks & Regards*

Unmesha Sreeveni U.B

*Junior Developer*
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB