Merge -r 1198909:1198910 from trunk to branch-0.23. Fixes: MAPREDUCE-3344.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1198914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas White 2011-11-07 20:16:12 +00:00
parent 240c74b632
commit 4f5fdb21cc
2 changed files with 9 additions and 3 deletions

View File

@ -31,6 +31,9 @@ Release 0.23.1 - Unreleased
MAPREDUCE-3291. App fail to launch due to delegation token not MAPREDUCE-3291. App fail to launch due to delegation token not
found in cache (Robert Evans via mahadev) found in cache (Robert Evans via mahadev)
MAPREDUCE-3344. o.a.h.mapreduce.Reducer since 0.21 blindly casts to
ReduceContext.ValueIterator. (Brock Noland via tomwhite)
Release 0.23.0 - 2011-11-01 Release 0.23.0 - 2011-11-01
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -26,6 +26,8 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.RawComparator; import org.apache.hadoop.io.RawComparator;
import org.apache.hadoop.mapred.RawKeyValueIterator; import org.apache.hadoop.mapred.RawKeyValueIterator;
import java.util.Iterator;
/** /**
* Reduces a set of intermediate values which share a key to a smaller set of * Reduces a set of intermediate values which share a key to a smaller set of
* values. * values.
@ -162,14 +164,15 @@ public class Reducer<KEYIN,VALUEIN,KEYOUT,VALUEOUT> {
* {@link #run(org.apache.hadoop.mapreduce.Reducer.Context)} method to * {@link #run(org.apache.hadoop.mapreduce.Reducer.Context)} method to
* control how the reduce task works. * control how the reduce task works.
*/ */
@SuppressWarnings("unchecked")
public void run(Context context) throws IOException, InterruptedException { public void run(Context context) throws IOException, InterruptedException {
setup(context); setup(context);
while (context.nextKey()) { while (context.nextKey()) {
reduce(context.getCurrentKey(), context.getValues(), context); reduce(context.getCurrentKey(), context.getValues(), context);
// If a back up store is used, reset it // If a back up store is used, reset it
((ReduceContext.ValueIterator) Iterator<VALUEIN> iter = context.getValues().iterator();
(context.getValues().iterator())).resetBackupStore(); if(iter instanceof ReduceContext.ValueIterator) {
((ReduceContext.ValueIterator<VALUEIN>)iter).resetBackupStore();
}
} }
cleanup(context); cleanup(context);
} }