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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • Fully Compatible
    • ALL
    • 131

      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.

            Assignee:
            rui.liu@mongodb.com Rui Liu
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: