Just like this!!!!!!!!!!!!!!!!
===============================================================
public static class Reduce extends MapReduceBase implements Reducer<IntWritable, Text, NullWritable, Text> { @Override public void reduce(IntWritable dummy, Iterator<Text> values, OutputCollector<NullWritable, Text> output, Reporter reporter) throws IOException { List<Text> cache = new ArrayList<Text>(); // first loop and caching while (values.hasNext()) { cache.add(new Text(values.next())); } // second loop for(Text p:cache) { output.collect(NullWritable.get(), p); } } }
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。