2014-01-15 47 views
0

Iam初学者到hadoop。我决定创建一个情感分析程序。我有一个映射器类。映射器的输出是LongWritable和Text格式。输入到减速器。因此,我有一个减速器类忽略hadoop减速器

public class sentreducer extends Reducer<LongWritable,Text,LongWritable,Text>{ 
      @Override 
      public void reduce(LongWritable key,Iterable<Text>value,Context context){ 
      } 

编译器显示错误,说该方法不能被重写。为什么?

回答

0

我认为你必须在减少方法抛出IOException的一个和InterruptedException的即

public class sentreducer extends Reducer<LongWritable,Text,LongWritable,Text>{ 
    @Override 
    public void reduce(LongWritable key,Iterable<Text> value,Context context) throws IOException, InterruptedException { 
    } 
} 
+0

true :)现在工作 – Rakshith

1

方法签名应该是

public void reduce(LongWritable key, Iterator<Text> values, 
     OutputCollector<LongWritable, Text> collector, Reporter reporter) throws IOException 
+0

这工作。但我相信这是旧的Hadoop Api,其中您正在扩展mapreduce类 – Rakshith

+0

是的,我已经完成了hadoop 1.2的工作。 – Rahul