-1

实际上,我的 reducer 键是自定义键 (word1, word2) ,我想以 "word1\tword2" 之类的格式编写输出。而我无法做到这一点。

任何帮助表示赞赏。

谢谢。

编辑:一对之间已经有 \t ......我没有注意到它!

4

1 回答 1

0

你遇到什么错误试试这个

public void reduce(Text key, Iterable<IntWritable> values,Context context) 
        throws IOException, InterruptedException {

  CustomKey customkey = (CustomKey) key;

  context.write(new Text(customkey.word1+"/"+customkey.word2), result);
}
于 2012-10-03T08:49:54.160 回答