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

Equality semantics changed for double/decimal in SBE

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: 5.0.0-rc2
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • 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.
    • Query Execution 2021-07-26, QE 2021-08-09, QE 2021-08-23, QE 2021-09-06, QE 2021-09-20

      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. ksuarz@gmail.com suggested that this is likely due to the new SBE engine.

            Assignee:
            martin.neupauer@mongodb.com Martin Neupauer
            Reporter:
            brian.deleonardis@mongodb.com Brian DeLeonardis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: