[英]Override in hadoop reducer
Iam a beginner to hadoop. 我是一个初学者,可以戴上帽子。 I decided to create a sentiment analysis program .I have a mapper class.
我决定创建一个情感分析程序。我有一个mapper类。 Output of the mapper is LongWritable and Text format.
映射器的输出是LongWritable和Text格式。 which is input to the reducer.
输入到减速器。 Hence i have a reducer class as
因此我有一个减速器类
public class sentreducer extends Reducer<LongWritable,Text,LongWritable,Text>{
@Override
public void reduce(LongWritable key,Iterable<Text>value,Context context){
}
Compiler shows an error saying that the method cannot be overriden. 编译器显示错误,指出无法重写该方法。 Why is that so?
为什么会这样?
the method signature should be 方法签名应为
public void reduce(LongWritable key, Iterator<Text> values,
OutputCollector<LongWritable, Text> collector, Reporter reporter) throws IOException
I think you must be throwing a IOException and InterruptedException in your reduce method ie 我认为您必须在您的reduce方法中抛出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 {
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.