hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r390232 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/MapRunner.java
Date Thu, 30 Mar 2006 20:14:39 GMT
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);
       }



Mime
View raw message