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

Document need for stable hashCode() in WritableComparable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.23.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: