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

Generation of $expr doesn't use type information

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2024-02-19
    • 35

      We currently support dateDiff() only because the time field has a declared type that allows the removal of the extra checks on the input type.
      Writing the query

      [{$match:  {
                      "$expr": {
                          "$gt": [
                              {
                                  "$dateDiff": {
                                      "startDate": "$time",
                                      "endDate": new Date(datePrefix + 150),
                                      "unit": "millisecond"
                                  }
                              },
                              0
                          ]
                      }
                  }
      }]
      

      generates a plan using the non-optimized tree that includes a few calls to typeMatch() that, being not yet supported, don't allow the vectorized execution of dateDiff().

      Probably this is caused by not forwarding the type information into the conversion from ABT to EExpr

            Assignee:
            projjal.chanda@mongodb.com Projjal Chanda
            Reporter:
            alberto.massari@mongodb.com Alberto Massari
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: