org.apache.hadoop.mapreduce
Class ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
java.lang.Object
org.apache.hadoop.mapreduce.JobContext
org.apache.hadoop.mapreduce.TaskAttemptContext
org.apache.hadoop.mapreduce.TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
org.apache.hadoop.mapreduce.ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Type Parameters:
KEYIN
- the class of the input keysVALUEIN
- the class of the input valuesKEYOUT
- the class of the output keysVALUEOUT
- the class of the output values
- All Implemented Interfaces:
- Progressable
- Direct Known Subclasses:
- Reducer.Context
public class ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- extends TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
The context passed to the Reducer
.
Fields inherited from class org.apache.hadoop.mapreduce.JobContext |
CACHE_ARCHIVES_VISIBILITIES, CACHE_FILE_VISIBILITIES, COMBINE_CLASS_ATTR, conf, credentials, INPUT_FORMAT_CLASS_ATTR, JOB_ACL_MODIFY_JOB, JOB_ACL_VIEW_JOB, JOB_CANCEL_DELEGATION_TOKEN, JOB_NAMENODES, MAP_CLASS_ATTR, OUTPUT_FORMAT_CLASS_ATTR, PARTITIONER_CLASS_ATTR, REDUCE_CLASS_ATTR, ugi, USER_LOG_RETAIN_HOURS |
Constructor Summary |
ReduceContext(Configuration conf,
TaskAttemptID taskid,
RawKeyValueIterator input,
Counter inputKeyCounter,
Counter inputValueCounter,
RecordWriter<KEYOUT,VALUEOUT> output,
OutputCommitter committer,
StatusReporter reporter,
RawComparator<KEYIN> comparator,
Class<KEYIN> keyClass,
Class<VALUEIN> valueClass)
|
Methods inherited from class org.apache.hadoop.mapreduce.JobContext |
getCombinerClass, getConfiguration, getCredentials, getGroupingComparator, getInputFormatClass, getJar, getJobID, getJobName, getMapOutputKeyClass, getMapOutputValueClass, getMapperClass, getNumReduceTasks, getOutputFormatClass, getOutputKeyClass, getOutputValueClass, getPartitionerClass, getReducerClass, getSortComparator, getWorkingDirectory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
reporter
protected Progressable reporter
ReduceContext
public ReduceContext(Configuration conf,
TaskAttemptID taskid,
RawKeyValueIterator input,
Counter inputKeyCounter,
Counter inputValueCounter,
RecordWriter<KEYOUT,VALUEOUT> output,
OutputCommitter committer,
StatusReporter reporter,
RawComparator<KEYIN> comparator,
Class<KEYIN> keyClass,
Class<VALUEIN> valueClass)
throws InterruptedException,
IOException
- Throws:
InterruptedException
IOException
nextKey
public boolean nextKey()
throws IOException,
InterruptedException
- Start processing next unique key.
- Throws:
IOException
InterruptedException
nextKeyValue
public boolean nextKeyValue()
throws IOException,
InterruptedException
- Advance to the next key/value pair.
- Specified by:
nextKeyValue
in class TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the key object that was read into, or null if no more
- Throws:
IOException
InterruptedException
getCurrentKey
public KEYIN getCurrentKey()
- Description copied from class:
TaskInputOutputContext
- Get the current key.
- Specified by:
getCurrentKey
in class TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the current key object or null if there isn't one
getCurrentValue
public VALUEIN getCurrentValue()
- Description copied from class:
TaskInputOutputContext
- Get the current value.
- Specified by:
getCurrentValue
in class TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the value object that was read into
getValues
public Iterable<VALUEIN> getValues()
throws IOException,
InterruptedException
- Iterate through the values for the current key, reusing the same value
object, which is stored in the context.
- Returns:
- the series of values associated with the current key. All of the
objects returned directly and indirectly from this method are reused.
- Throws:
IOException
InterruptedException
Copyright © 2009 The Apache Software Foundation