以下是我的reducer代码。我应该做的是从mapper发送arraylist到reducer和reducer,想要打印从mapper传递的值,但问题是在reducer中它没有做任何事情。它只涉及减速机,打印机和减速机"什么都不做请帮助找出错误。
public class firstreducer extends Reducer<LongWritable, IntArrayWritable, LongWritable, IntArrayWritable>
{
public void reduce(LongWritable key, Iterable<IntArrayWritable> values, Context context)
throws IOException, InterruptedException
{
System.out.println("reducer");
int[] sum = new int[2];
for(IntArrayWritable val: values) {
IntWritable[] temp = new IntWritable[2];
temp = (val.get());
for(int i = 0; i < 2; i++) {
sum[i] = Integer.parseInt(temp[i].toString());
System.out.println(sum[i]);
}
}