Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-92592

Equal ArraySets may have different hash values

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0, 8.0.0-rc14, 7.0.16
    • Affects Version/s: 6.0.16, 7.0.12, 8.0.0-rc13
    • Component/s: None
    • Query Execution
    • Fully Compatible
    • ALL
    • v8.0, v7.0, v6.0
    • Hide

      See check.js

      Show
      See check.js
    • QE 2024-07-22, QE 2024-08-05
    • 200

      Hash value for ArraySet is order-dependent: https://github.com/mongodb/mongo/blob/ad8894ae07b93c175e90f992e517160f286c328c/src/mongo/db/exec/sbe/values/value.cpp#L460
      So we can have equal sets with different hash values. This basically breaks hash sets and hash maps if ArraySet is used as a key.

      It actually can cause queries to produce wrong results if $group uses ArraySet as _id.

            Assignee:
            ivan.fefer@mongodb.com Ivan Fefer
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: