[ 
https://issues.apache.org/jira/browse/HADOOP-9154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13560600#comment-13560600
 ] 

Tom White commented on HADOOP-9154:
-----------------------------------

Sorry to come to this late, but I feel that we should just fix the bug and not 
perform such extensive refactoring here. This is stable code and we need to be 
sure that such a change doesn't break compatibility.

The following fix plus a unit test to show the problem should suffice, no?

{noformat}
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SortedMapWritable.java
 b/hadoop-common-p
index eee744e..b533d94 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SortedMapWritable.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SortedMapWritable.java
@@ -141,7 +141,7 @@ public void putAll(Map<? extends WritableComparable, ? 
extends Writable> t) {
     for (Map.Entry<? extends WritableComparable, ? extends Writable> e:
       t.entrySet()) {
       
-      instance.put(e.getKey(), e.getValue());
+      put(e.getKey(), e.getValue());
     }
   }
{noformat}

                
> SortedMapWritable#putAll() doesn't add key/value classes to the map
> -------------------------------------------------------------------
>
>                 Key: HADOOP-9154
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9154
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: io
>    Affects Versions: 2.0.2-alpha
>            Reporter: Karthik Kambatla
>            Assignee: Karthik Kambatla
>         Attachments: HADOOP-9124.patch, hadoop-9154-draft.patch, 
> hadoop-9154.patch, hadoop-9154.patch
>
>
> In the following code from {{SortedMapWritable}}, #putAll() doesn't add 
> key/value classes to the class-id maps.
> {code}
>   @Override
>   public Writable put(WritableComparable key, Writable value) {
>     addToMap(key.getClass());
>     addToMap(value.getClass());
>     return instance.put(key, value);
>   }
>   @Override
>   public void putAll(Map<? extends WritableComparable, ? extends Writable> t){
>     for (Map.Entry<? extends WritableComparable, ? extends Writable> e:
>       t.entrySet()) {
>       
>       instance.put(e.getKey(), e.getValue());
>     }
>   }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to