Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4096

Change Pair.hashCode() not to use XOR

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • 1.24.0
    • core
    • None

    Description

      JDK Map Entry uses XOR maybe because it is unlikely to use Map Entry as the HashMap key.

      But Pair in Calcite is a general data structure, it is used in several places as the key of HashMap/HashSet. XOR is not a good candidate for hash algorithm, it is more likely to generate hash collision than simple prime multiplication, especially when pair.left equals pair.right.

      Attachments

        Activity

          People

            Unassigned Unassigned
            hyuan Haisheng Yuan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: