我是hadoop
的新手,并且正在使用hadoop
和mongodb
。使用mongodb connector
。我必须开发mapreduce
programm。
这是我的mapper
public static class Map extends Mapper < Object, BSONObject, Text, IntWritable > {
public void map(final Object key, final BSONObject value, final Context context) throws IOException, InterruptedException {
System.out.println(value.get("-ID"));
System.out.println(value.get("-name"));
System.out.println(value.get("parameter"));
//String[] arr = (String[]) value.get("parameter");
context.write(new Text("hello"), new IntWritable(4));
}
}
我担心的是,如果我在mapper中取消注释上面的行,则我的mapper在仅打印三个语句后停止。它不会进一步迭代,否则会正常工作。我缺少什么?
最佳答案
请验证 list ,以使用BSON输入来映射reduce here
关于mongodb - 无法在mapreduce程序中使用数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31026670/