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

Difference in behavior in SBE window fields implementation with classic in presence of NaN

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Execution
    • ALL
    • 146

    Description

      When using setWindowFields with a sortBy on a field that can be NaN, classic and SBE produce different results. Minimal repro:

      (function() {                                                                                         
          const documentList = [                                                                            
              {_id: 0"num": 123}, // 0                                                                   
              {_id: 11"num": NaN }, // 3                                                                 
          ];                                                                                                
                                                                                                            
                                                                                                            
          for (let d of documentList) {                                                                     
              db.c.insert(d);                                                                               
          }                                                                                                 
                                                                                                            
          const aggPipe = [                                                                                 
              {$sort: {_id: 1}},                                                                            
               {$setWindowFields: {sortBy: {"num": 1},                                                      
                                   output: {"test": {$min: "constant",                                      
                                                     window: {range: ["current", 0]}}}}}                    
          ];                                                                                                
                                                                                                            
          //print("EXPLAIN: \n" +                                                                           
          //db.c.explain().aggregate(aggPipe).queryPlanner.winningPlan.slotBasedPlan.stages);               
                                                                                                            
          print("RESULTS: " + tojson(db.c.aggregate(aggPipe).toArray()));                                   
                                                                                                            
      })();  

      You can run this with:

      python3 buildscripts/resmoke.py run --dbpathPrefix /home/ubuntu/data --installDir build/install/bin '--mongodSetParameters={internalQueryFrameworkControl: "trySbeEngine"}' --suites=core windowfields.js 

      And compare to the results that 7.0 gives or that are given with internalQueryFrameworkControl=trySbeRestricted.

      Attachments

        Activity

          People

            backlog-query-execution Backlog - Query Execution
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: