Hadoop Common
  1. Hadoop Common
  2. HADOOP-9124

SortedMapWritable violates contract of Map interface for equals() and hashCode()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.1, 2.0.2-alpha
    • Fix Version/s: 1.2.0, 2.0.3-alpha, 0.23.7
    • Component/s: io
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      This issue is similar to HADOOP-7153. It was found when using MRUnit - see MRUNIT-158, specifically https://issues.apache.org/jira/browse/MRUNIT-158?focusedCommentId=13501985&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13501985


      o.a.h.io.SortedMapWritable 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 SortedMapWritables 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.

      1. hadoop-9124-branch1.patch
        4 kB
        Karthik Kambatla
      2. HADOOP-9124.patch
        5 kB
        Tom White
      3. HADOOP-9124.patch
        5 kB
        Surenkumar Nihalani
      4. HADOOP-9124.patch
        4 kB
        Surenkumar Nihalani
      5. HADOOP-9124.patch
        5 kB
        Surenkumar Nihalani
      6. HADOOP-9124.patch
        5 kB
        Surenkumar Nihalani
      7. HADOOP-9124.patch
        4 kB
        Surenkumar Nihalani
      8. HADOOP-9124.patch
        5 kB
        Surenkumar Nihalani
      9. HADOOP-9124.patch
        4 kB
        Surenkumar Nihalani
      10. HADOOP-9124.patch
        4 kB
        Surenkumar Nihalani
      11. HADOOP-9124.patch
        0.6 kB
        Surenkumar Nihalani

        Issue Links

          Activity

          Patrick Hunt created issue -
          Patrick Hunt made changes -
          Field Original Value New Value
          Link This issue relates to MRUNIT-158 [ MRUNIT-158 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12561403 ]
          Surenkumar Nihalani made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12561458 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12561459 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12561458 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12561462 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12561963 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12562018 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12562134 ]
          Karthik Kambatla (Inactive) made changes -
          Link This issue relates to HADOOP-9154 [ HADOOP-9154 ]
          Tom White made changes -
          Link This issue is related to HADOOP-7153 [ HADOOP-7153 ]
          Karthik Kambatla (Inactive) made changes -
          Link This issue blocks HADOOP-9154 [ HADOOP-9154 ]
          Karthik Kambatla (Inactive) made changes -
          Link This issue relates to HADOOP-9154 [ HADOOP-9154 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12566787 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12566969 ]
          Surenkumar Nihalani made changes -
          Attachment HADOOP-9124.patch [ 12566975 ]
          Tom White made changes -
          Attachment HADOOP-9124.patch [ 12567368 ]
          Tom White made changes -
          Assignee Surenkumar Nihalani [ snihalani ]
          Tom White made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags Reviewed [ 10343 ]
          Fix Version/s 2.0.3-alpha [ 12323273 ]
          Resolution Fixed [ 1 ]
          Karthik Kambatla (Inactive) made changes -
          Attachment hadoop-9124-branch1.patch [ 12567603 ]
          Karthik Kambatla (Inactive) made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Karthik Kambatla (Inactive) made changes -
          Affects Version/s 1.1.1 [ 12321658 ]
          Target Version/s 1.2.0 [ 12321659 ]
          Thomas Graves made changes -
          Fix Version/s 0.23.7 [ 12323956 ]
          Tom White made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Fix Version/s 1.2.0 [ 12321659 ]
          Resolution Fixed [ 1 ]
          Arun C Murthy made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Surenkumar Nihalani
              Reporter:
              Patrick Hunt
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development