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

Equality semantics changed for double/decimal in SBE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 5.0.0-rc2
    • Fix Version/s: 5.1.0-rc0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Create a collection: lookup_numeric_mixed:

      { "_id" : ObjectId("60db590cbb5709ba513cb8c9"), "a" : 5.01 } { "_id" : ObjectId("60db5914bb5709ba513cb8ca"), "a" : NumberDecimal("5.01") } { "_id" : ObjectId("60db591cbb5709ba513cb8cb"), "a" : NumberDecimal("5.0100") }

      Run the following pipeline on it:
      [
      {
      "$lookup":

      { "from": "lookup_numeric_mixed", "localField": "a", "foreignField": "a", "as": "docs" }

      },
      {
      "$project":

      { "_id": 0, "docs._id": 0 }

      }
      ]
      Observe that the results on 4.4 and 5.0rc2 are different.

      Show
      Create a collection: lookup_numeric_mixed: { "_id" : ObjectId("60db590cbb5709ba513cb8c9"), "a" : 5.01 } { "_id" : ObjectId("60db5914bb5709ba513cb8ca"), "a" : NumberDecimal("5.01") } { "_id" : ObjectId("60db591cbb5709ba513cb8cb"), "a" : NumberDecimal("5.0100") } Run the following pipeline on it: [ { "$lookup": { "from": "lookup_numeric_mixed", "localField": "a", "foreignField": "a", "as": "docs" } }, { "$project": { "_id": 0, "docs._id": 0 } } ] Observe that the results on 4.4 and 5.0rc2 are different.
    • Sprint:
      Query Execution 2021-07-26, QE 2021-08-09, QE 2021-08-23, QE 2021-09-06, QE 2021-09-20

      Description

      In 4.4 the values: 5.01 (a double) and NumberDecimal("5.01") are not equal to each other according to $lookup with localField/foreignField. However when I tested this on 5.0rc2 they were counted as equal. This behavior did not occur on rc5. Kyle Suarez suggested that this is likely due to the new SBE engine.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              martin.neupauer Martin Neupauer
              Reporter:
              brian.deleonardis Brian DeLeonardis
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: