在第一次读取时,映射reduce reduce在映射时失败

时间:2015-03-16 22:07:41

标签: java dictionary reduce

当我尝试在简单输入上调试我的程序时,它在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

0 个答案:

没有答案