hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CloudyEye <suhe...@gmail.com>
Subject Re: How can I use counters in Hadoop
Date Wed, 16 Apr 2008 08:51:49 GMT

Thank you. I tried a while with some code but I did not succeed in getting
the value of counters. Please check this code:

public class MyMapper extends MapReduceBase implements Mapper {
	private static enum myCounters {NUMBER_OF_ROWS}

	public void map(WritableComparable key, Writable values,
			OutputCollector output, Reporter reporter) throws IOException {

		reporter.incrCounter(myCounters.NUMBER_OF_ROWS, 1);		

And here is my simple reducer:
public class MyReduce extends MapReduceBase implements Reducer {
	private static enum myCounters {NUMBER_OF_ROWS}
	private static long numOfRows;
	public void configure(JobConf job) {
		this.numOfRows= ????

How can I assign the value of counter: NUMBER_OF_ROWS to the long variable
numOfRows  ??

Best regards,

stack-3 wrote:
> https://issues.apache.org/jira/browse/HBASE-559 has an example. Ignore 
> the HBase stuff.  Whats important is the ENUM at head of the MR job 
> class, the calls to Reporter inside in tasks, and the properties file -- 
> both how its named and that it ends up in the generated job jar.
> St.Ack

View this message in context: http://www.nabble.com/How-can-I-use-counters-in-Hadoop-tp16702607p16719201.html
Sent from the Hadoop core-user mailing list archive at Nabble.com.

View raw message