hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r1446187 - in /hadoop/common/branches/branch-1: CHANGES.txt src/core/org/apache/hadoop/io/AbstractMapWritable.java src/core/org/apache/hadoop/io/SortedMapWritable.java src/test/org/apache/hadoop/io/TestSortedMapWritable.java
Date Thu, 14 Feb 2013 14:10:14 GMT
Author: tomwhite
Date: Thu Feb 14 14:10:13 2013
New Revision: 1446187

URL: http://svn.apache.org/r1446187
Log:
HADOOP-9154. SortedMapWritable#putAll() doesn't add key/value classes to the map. Contributed
by Karthik Kambatla.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/AbstractMapWritable.java
    hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/SortedMapWritable.java
    hadoop/common/branches/branch-1/src/test/org/apache/hadoop/io/TestSortedMapWritable.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1446187&r1=1446186&r2=1446187&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Thu Feb 14 14:10:13 2013
@@ -490,6 +490,9 @@ Release 1.2.0 - unreleased
     HDFS-4466. Remove the deadlock from AbstractDelegationTokenSecretManager.
     (Brandon Li via suresh)
 
+    HADOOP-9154. SortedMapWritable#putAll() doesn't add key/value classes to
+    the map. (Karthik Kambatla via tomwhite)
+
 Release 1.1.2 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/AbstractMapWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/AbstractMapWritable.java?rev=1446187&r1=1446186&r2=1446187&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/AbstractMapWritable.java
(original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/AbstractMapWritable.java
Thu Feb 14 14:10:13 2013
@@ -43,10 +43,10 @@ public abstract class AbstractMapWritabl
   private AtomicReference<Configuration> conf;
   
   /* Class to id mappings */
-  private Map<Class, Byte> classToIdMap = new ConcurrentHashMap<Class, Byte>();
+  Map<Class, Byte> classToIdMap = new ConcurrentHashMap<Class, Byte>();
   
   /* Id to Class mappings */
-  private Map<Byte, Class> idToClassMap = new ConcurrentHashMap<Byte, Class>();
+  Map<Byte, Class> idToClassMap = new ConcurrentHashMap<Byte, Class>();
   
   /* The number of new classes (those not established by the constructor) */
   private volatile byte newClasses = 0;

Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/SortedMapWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/SortedMapWritable.java?rev=1446187&r1=1446186&r2=1446187&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/SortedMapWritable.java (original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/io/SortedMapWritable.java Thu
Feb 14 14:10:13 2013
@@ -139,7 +139,7 @@ public class SortedMapWritable extends A
     for (Map.Entry<? extends WritableComparable, ? extends Writable> e:
       t.entrySet()) {
       
-      instance.put(e.getKey(), e.getValue());
+      put(e.getKey(), e.getValue());
     }
   }
 

Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/io/TestSortedMapWritable.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/io/TestSortedMapWritable.java?rev=1446187&r1=1446186&r2=1446187&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/io/TestSortedMapWritable.java
(original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/io/TestSortedMapWritable.java
Thu Feb 14 14:10:13 2013
@@ -164,4 +164,18 @@ public class TestSortedMapWritable {
     assertTrue(failureReason, !mapA.equals(mapB));
     assertTrue(failureReason, !mapB.equals(mapA));
   }
+
+  @Test(timeout = 1000)
+  public void testPutAll() {
+    SortedMapWritable map1 = new SortedMapWritable();
+    SortedMapWritable map2 = new SortedMapWritable();
+    map1.put(new Text("key"), new Text("value"));
+    map2.putAll(map1);
+
+    assertEquals("map1 entries don't match map2 entries", map1, map2);
+    assertTrue(
+        "map2 doesn't have class information from map1",
+        map2.classToIdMap.containsKey(Text.class)
+            && map2.idToClassMap.containsValue(Text.class));
+  }
 }



Mime
View raw message