You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2011/03/01 08:17:37 UTC

[jira] Commented: (HADOOP-7153) MapWritable violates contract of Map interface for equals() and hashCode()

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

Hudson commented on HADOOP-7153:
--------------------------------

Integrated in Hadoop-Common-trunk #616 (See [https://hudson.apache.org/hudson/job/Hadoop-Common-trunk/616/])
    HADOOP-7153. MapWritable violates contract of Map interface for equals() and hashCode(). Contributed by Nicholas Telford.


> MapWritable violates contract of Map interface for equals() and hashCode()
> --------------------------------------------------------------------------
>
>                 Key: HADOOP-7153
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7153
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 0.21.0
>            Reporter: Nicholas Telford
>            Assignee: Nicholas Telford
>            Priority: Minor
>             Fix For: 0.23.0
>
>         Attachments: 7153-mapwritable-equality-test.diff, 7153-mapwritable-equality.combined.diff, 7153-mapwritable-equality.diff
>
>
> o.a.h.io.MapWritable implements the java.util.Map interface, however it does not define an implementation of the equals() or hashCode() methods; instead the default implementations in java.lang.Object are used.
> This violates the contract of the Map interface which defines different behaviour for equals() and hashCode() than Object does. More information here: http://download.oracle.com/javase/6/docs/api/java/util/Map.html#equals(java.lang.Object)
> The practical consequence is that MapWritables containing equal entries cannot be compared properly. We were bitten by this when trying to write an MRUnit test for a Mapper that outputs MapWritables; the MRUnit driver cannot test the equality of the expected and actual MapWritable objects.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira