All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.hadoop.mapreduce.ReduceContext Maven / Gradle / Ivy

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.hadoop.mapreduce;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;

/**
 * The context passed to the {@link Reducer}.
 * @param  the class of the input keys
 * @param  the class of the input values
 * @param  the class of the output keys
 * @param  the class of the output values
 */
@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface ReduceContext
    extends TaskInputOutputContext {

  /** Start processing next unique key. */
  public boolean nextKey() throws IOException,InterruptedException;

  /**
   * Iterate through the values for the current key, reusing the same value 
   * object, which is stored in the context.
   * @return the series of values associated with the current key. All of the 
   * objects returned directly and indirectly from this method are reused.
   */
  public Iterable getValues() throws IOException, InterruptedException;

  /**
   * {@link Iterator} to iterate over values for a given group of records.
   */
  interface ValueIterator extends MarkableIteratorInterface {

    /**
     * This method is called when the reducer moves from one key to 
     * another.
     * @throws IOException
     */
    void resetBackupStore() throws IOException;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy