2014-01-15 48 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