1 /* Copyright (c) 2005 The Nutch Organization. All rights reserved. */ 2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */ 3 4 package net.nutch.mapReduce; 5 6 import java.io.IOException; 7 8 import java.util.Iterator; 9 10 import net.nutch.io.Writable; 11 import net.nutch.io.WritableComparable; 12 13 /** Reduces a set of intermediate values which share a key to a smaller set of 14 * values. Input values are the grouped output of a {@link Mapper}. */ 15 public interface Reducer { 16 /** Combines values for a given key. Output values must be of the same type 17 * as input values. Input keys must not be altered. Typically all values 18 * are combined into zero or one value. Output pairs are collected with 19 * calls to {@link OutputCollector#collect(WritableComparable,Writable)}. 20 * 21 * @param key the key 22 * @param values the values to combine 23 * @param output to collect combined values 24 */ 25 void reduce(WritableComparable key, Iterator values, OutputCollector output) 26 throws IOException; 27 } 28