You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/03/30 22:14:39 UTC
svn commit: r390232 -
/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java
Author: cutting
Date: Thu Mar 30 12:14:36 2006
New Revision: 390232
URL: http://svn.apache.org/viewcvs?rev=390232&view=rev
Log:
Fix for HADOOP-110. Reuse keys and values when mapping. Contributed by Owen O'Malley.
Modified:
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java?rev=390232&r1=390231&r2=390232&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java Thu Mar 30 12:14:36 2006
@@ -39,16 +39,11 @@
Reporter reporter)
throws IOException {
try {
- while (true) {
- // allocate new key & value instances
- WritableComparable key =
- (WritableComparable)job.newInstance(inputKeyClass);
- Writable value = (Writable)job.newInstance(inputValueClass);
-
- // read next key & value
- if (!input.next(key, value))
- return;
-
+ // allocate key & value instances that are re-used for all entries
+ WritableComparable key =
+ (WritableComparable)job.newInstance(inputKeyClass);
+ Writable value = (Writable)job.newInstance(inputValueClass);
+ while (input.next(key, value)) {
// map pair to output
mapper.map(key, value, output, reporter);
}