Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-7151

Document need for stable hashCode() in WritableComparable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.23.0
    • None
    • None
    • Reviewed

    Description

      When a Writable is used as a key, HashPartitioner implicitly assumes that hashCode() will return the same value across different instances of the JVM. This is not a guaranteed behavior in Java, and Object's default hashCode() does not in fact do this, which can lead to subtle bugs. This requirement should be explicitly called out.

      In addition the sample MyWritable in the javadoc for WritableComparable does not implement hashCode() and thus has a bug. That should be fixed.

      Attachments

        1. HADOOP-7151.patch
          1 kB
          Dmitriy V. Ryaboy
        2. HADOOP-7151.patch
          2 kB
          Dmitriy V. Ryaboy

        Activity

          People

            dvryaboy Dmitriy V. Ryaboy
            dvryaboy Dmitriy V. Ryaboy
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: