Hi,

The @Override annotation worked because, without it the reduce method in
the superclass (Reducer) was being invoked, which basically writes the
input from the mapper class to the context object. Try to look up the
source code for the Reducer class online and you'll realize that.

Hope that clears it up.

Cheers,
Arun

Sent from a mobile device. Please don't mind the typos.
Hi Shahab,

Thanks for the response.

I have added the @Override and somehow that worked. I have pasted the new
Reducer code below.

Though, I did not understood the difference here, as if what I have done
differently. I might be a very silly reason though.

=========================================================
package com.test.hadoop;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class WordCountReducer extends Reducer<Text, IntWritable, Text,
IntWritable> {

        @Override
        protected void reduce(Text key, Iterable<IntWritable> values,
Context
context)
                        throws IOException, InterruptedException {

                int sum = 0;
                for (IntWritable val : values) {
                        sum += val.get();
                }
                context.write(key, new IntWritable(sum));
        }
}
=========================================================

Regards,
Parkirat Bagga.



--
View this message in context:
http://apache-hbase.679495.n3.nabble.com/Hbase-Mapreduce-API-Reduce-to-a-file-is-not-working-properly-tp4062141p4062240.html
Sent from the HBase User mailing list archive at Nabble.com.

Reply via email to