【发布时间】:2013-12-26 20:14:11
【问题描述】:
我是使用 Avro 编写 Hadoop MapReduce 的初学者,我不清楚通过 String、CharSequence 或 Utf8 将 Pair 传递给 map/reduce 方法之间有什么区别?
如果字符串只是“hello world”之类的东西怎么办?
这里有一个简单的 map 方法例如,在这种情况下使用 CharSequence 作为输出键类型:
public void map(Pair<CharSequence, Integer> datum, AvroCollector<Pair<CharSequence, Integer>> collector, Reporter reporter) throws IOException {
Integer number_one = new Integer(1);
String output_key = "hello world";
collector.collect(new Pair<CharSequence, Integer>(output_key, one));
}
感谢任何帮助!
【问题讨论】:
标签: java hadoop mapreduce avro