|
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.
|