org.apache.hadoop.mapreduce.task
Class ReduceContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
java.lang.Object
org.apache.hadoop.mapreduce.task.JobContextImpl
org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
org.apache.hadoop.mapreduce.task.TaskInputOutputContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
org.apache.hadoop.mapreduce.task.ReduceContextImpl<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:
- JobContext, ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>, TaskAttemptContext, TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>, org.apache.hadoop.util.Progressable
public class ReduceContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- extends TaskInputOutputContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- implements ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
The context passed to the Reducer
.
Field Summary |
protected org.apache.hadoop.util.Progressable |
reporter
|
Fields inherited from interface org.apache.hadoop.mapreduce.JobContext |
CACHE_ARCHIVES_VISIBILITIES, CACHE_FILE_VISIBILITIES, COMBINE_CLASS_ATTR, INPUT_FORMAT_CLASS_ATTR, JAR_UNPACK_PATTERN, JOB_ACL_MODIFY_JOB, JOB_ACL_VIEW_JOB, JOB_CANCEL_DELEGATION_TOKEN, JOB_NAMENODES, MAP_CLASS_ATTR, MAP_MEMORY_PHYSICAL_MB, MAP_OUTPUT_COLLECTOR_CLASS_ATTR, MAPREDUCE_TASK_CLASSPATH_PRECEDENCE, OUTPUT_FORMAT_CLASS_ATTR, PARTITIONER_CLASS_ATTR, REDUCE_CLASS_ATTR, REDUCE_MEMORY_PHYSICAL_MB, SHUFFLE_CONSUMER_PLUGIN_ATTR, USER_LOG_RETAIN_HOURS |
Constructor Summary |
ReduceContextImpl(org.apache.hadoop.conf.Configuration conf,
TaskAttemptID taskid,
RawKeyValueIterator input,
Counter inputKeyCounter,
Counter inputValueCounter,
RecordWriter<KEYOUT,VALUEOUT> output,
OutputCommitter committer,
StatusReporter reporter,
org.apache.hadoop.io.RawComparator<KEYIN> comparator,
java.lang.Class<KEYIN> keyClass,
java.lang.Class<VALUEIN> valueClass)
|
Methods inherited from class org.apache.hadoop.mapreduce.task.JobContextImpl |
getArchiveClassPaths, getArchiveTimestamps, getCacheArchives, getCacheFiles, getCombinerClass, getCombinerKeyGroupingComparator, getConfiguration, getCredentials, getFileClassPaths, getFileTimestamps, getGroupingComparator, getInputFormatClass, getJar, getJobID, getJobName, getJobSetupCleanupNeeded, getLocalCacheArchives, getLocalCacheFiles, getMapOutputKeyClass, getMapOutputValueClass, getMapperClass, getMaxMapAttempts, getMaxReduceAttempts, getNumReduceTasks, getOutputFormatClass, getOutputKeyClass, getOutputValueClass, getPartitionerClass, getProfileEnabled, getProfileParams, getProfileTaskRange, getReducerClass, getSortComparator, getSymlink, getUser, getWorkingDirectory, setJobID, userClassesTakesPrecedence |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.mapreduce.JobContext |
getArchiveClassPaths, getArchiveTimestamps, getCacheArchives, getCacheFiles, getCombinerClass, getCombinerKeyGroupingComparator, getConfiguration, getCredentials, getFileClassPaths, getFileTimestamps, getGroupingComparator, getInputFormatClass, getJar, getJobID, getJobName, getJobSetupCleanupNeeded, getLocalCacheArchives, getLocalCacheFiles, getMapOutputKeyClass, getMapOutputValueClass, getMapperClass, getMaxMapAttempts, getMaxReduceAttempts, getNumReduceTasks, getOutputFormatClass, getOutputKeyClass, getOutputValueClass, getPartitionerClass, getProfileEnabled, getProfileParams, getReducerClass, getSortComparator, getSymlink, getUser, getWorkingDirectory, userClassesTakesPrecedence |
Methods inherited from interface org.apache.hadoop.util.Progressable |
progress |
reporter
protected org.apache.hadoop.util.Progressable reporter
ReduceContextImpl
public ReduceContextImpl(org.apache.hadoop.conf.Configuration conf,
TaskAttemptID taskid,
RawKeyValueIterator input,
Counter inputKeyCounter,
Counter inputValueCounter,
RecordWriter<KEYOUT,VALUEOUT> output,
OutputCommitter committer,
StatusReporter reporter,
org.apache.hadoop.io.RawComparator<KEYIN> comparator,
java.lang.Class<KEYIN> keyClass,
java.lang.Class<VALUEIN> valueClass)
throws java.lang.InterruptedException,
java.io.IOException
- Throws:
java.lang.InterruptedException
java.io.IOException
nextKey
public boolean nextKey()
throws java.io.IOException,
java.lang.InterruptedException
- Start processing next unique key.
- Specified by:
nextKey
in interface ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Throws:
java.io.IOException
java.lang.InterruptedException
nextKeyValue
public boolean nextKeyValue()
throws java.io.IOException,
java.lang.InterruptedException
- Advance to the next key/value pair.
- Specified by:
nextKeyValue
in interface TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Specified by:
nextKeyValue
in class TaskInputOutputContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the key object that was read into, or null if no more
- Throws:
java.io.IOException
java.lang.InterruptedException
getCurrentKey
public KEYIN getCurrentKey()
- Description copied from class:
TaskInputOutputContextImpl
- Get the current key.
- Specified by:
getCurrentKey
in interface TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Specified by:
getCurrentKey
in class TaskInputOutputContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the current key object or null if there isn't one
getCurrentValue
public VALUEIN getCurrentValue()
- Description copied from class:
TaskInputOutputContextImpl
- Get the current value.
- Specified by:
getCurrentValue
in interface TaskInputOutputContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Specified by:
getCurrentValue
in class TaskInputOutputContextImpl<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the value object that was read into
getValues
public java.lang.Iterable<VALUEIN> getValues()
throws java.io.IOException,
java.lang.InterruptedException
- Iterate through the values for the current key, reusing the same value
object, which is stored in the context.
- Specified by:
getValues
in interface ReduceContext<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
- Returns:
- the series of values associated with the current key. All of the
objects returned directly and indirectly from this method are reused.
- Throws:
java.io.IOException
java.lang.InterruptedException
Copyright © 2009 The Apache Software Foundation