You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by pols cut <po...@yahoo.co.in> on 2008/11/09 05:44:49 UTC
error with inout for the Reduce method
I am trying to get a simple map reduce function going but getting the following error. could anyone please help/guide me
filename.java is not abstract and does not override abstract method reduce<org.apache.io.text,java.util.iterator<org.apache.hadoop.io.text>,org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text.org.apache.hadoop.mapred.Reporter> in org.apache.hadoop.mapred.Reducer
public static class Reduce extends MapReduceBase implements Reducer<Text,Text,Text,Text>
My Map method is like this:
public static class map extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text>
{
public void map(LongWritable key, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException
{
output.collect(word_key,new Text(str1)); //output.collect(Text,Text)
}
}
public static class Reduce extends MapReduceBase implements Reducer<Text, Text, Text, Text>
{
public void Reduce(Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException
{
output.collect(new Text("Test"), new Text("Me"));
}
}
configuration is like :
conf.setMapOutputKeyClass(Text.class);
conf.setMapOutputValueClass(Text.class);
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(Text.class);
conf.setMapperClass(map.class);
conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
Re: error with inout for the Reduce method
Posted by Per Jacobsson <pe...@pjacobsson.com>.
Change the name of the reduce method to be all lower case -- "public void
reduce(..."
Right now the compiler is complaining that you haven't overridden the
correct abstract method in the base class.
/ Per
On Sat, Nov 8, 2008 at 10:44 PM, pols cut <po...@yahoo.co.in> wrote:
> I am trying to get a simple map reduce function going but getting the
> following error. could anyone please help/guide me
>
> filename.java is not abstract and does not override abstract method
> reduce<org.apache.io.text,java.util.iterator<org.apache.hadoop.io.text>,org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text.org.apache.hadoop.mapred.Reporter>
> in org.apache.hadoop.mapred.Reducer
> public static class Reduce extends MapReduceBase implements
> Reducer<Text,Text,Text,Text>
>
>
> My Map method is like this:
> public static class map extends MapReduceBase implements
> Mapper<LongWritable, Text, Text, Text>
> {
> public void map(LongWritable key, Text value, OutputCollector<Text, Text>
> output, Reporter reporter) throws IOException
> {
> output.collect(word_key,new Text(str1)); //output.collect(Text,Text)
>
> }
>
> }
>
> public static class Reduce extends MapReduceBase implements Reducer<Text,
> Text, Text, Text>
> {
>
> public void Reduce(Text key, Iterator<Text> values,
> OutputCollector<Text, Text> output, Reporter reporter) throws IOException
> {
> output.collect(new Text("Test"), new Text("Me"));
>
> }
> }
>
> configuration is like :
>
> conf.setMapOutputKeyClass(Text.class);
> conf.setMapOutputValueClass(Text.class);
> conf.setOutputKeyClass(Text.class);
> conf.setOutputValueClass(Text.class);
>
> conf.setMapperClass(map.class);
> conf.setCombinerClass(Reduce.class);
> conf.setReducerClass(Reduce.class);
>
> conf.setInputFormat(TextInputFormat.class);
> conf.setOutputFormat(TextOutputFormat.class);
>
>
> Add more friends to your messenger and enjoy! Go to
> http://messenger.yahoo.com/invite/