当我尝试在简单输入上调试我的程序时,它在context.write(text, text)
命令处失败。为什么会这样,我该如何解决?
public class TaskMapper extends Mapper<LongWritable, Text, Text, Text> {
private Text country = new Text();
private Text browser = new Text();
public void map(LongWritable offset, Text line, Context context)
throws IOException, InterruptedException {
String[] words = line.toString().split(" ");
country.set(words[1]);
browser.set(words[0]);
context.write(country, browser);
}
}
输入文件是:
Chrome Israel
IE Israel
Firefox Denmark
Safari Denmark
Chrome Israel