我有一个驱动程序类,Map器类和还原器类。mapreduce作业运行良好。但期望的结果却没有出现。我已经把system.out.println语句放进了减速机。我查看了mapper和reducer的日志。我放在mapper中的system.out.println语句可以在日志中看到,但是reducer中的println语句在日志中看不到。有没有可能减速机根本就没有启动?这是减速机的原木。
rqdpfwrv1#
代码没有变化。现在可以了。我所做的只是重新启动了hadoopcloudera映像,现在可以正常工作了。真不敢相信会发生这种事。
u59ebvdq2#
我假设这个问题是基于前面问题中的代码:mapreduce composite key sample-没有显示所需的输出
public class CompositeKeyReducer extends Reducer<Country, IntWritable, Country, IntWritable> { public void reduce(Country key, Iterator<IntWritable> values, Context context) throws IOException, InterruptedException { } }
reduce没有运行,因为 reduce 方法签名错误。您有: public void reduce(Country key, Iterator<IntWritable> values, Context context) 应该是: public void reduce(Country key, Iterable<IntWritable> values, Context context) 为了确保这种情况不再发生,您应该添加 @Override 类的注解。如果你的签名错了,这会告诉你的。
reduce
public void reduce(Country key, Iterator<IntWritable> values, Context context)
public void reduce(Country key, Iterable<IntWritable> values, Context context)
@Override
2条答案
按热度按时间rqdpfwrv1#
代码没有变化。现在可以了。我所做的只是重新启动了hadoopcloudera映像,现在可以正常工作了。真不敢相信会发生这种事。
u59ebvdq2#
我假设这个问题是基于前面问题中的代码:mapreduce composite key sample-没有显示所需的输出
reduce没有运行,因为
reduce
方法签名错误。您有:public void reduce(Country key, Iterator<IntWritable> values, Context context)
应该是:public void reduce(Country key, Iterable<IntWritable> values, Context context)
为了确保这种情况不再发生,您应该添加@Override
类的注解。如果你的签名错了,这会告诉你的。