-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Differences in the evaluation semantics of the $zip operator between SBE and the Classic engine result in the same expression succeeding on the Classic engine but failing with an error on SBE. This is because the Classic engine lazily evaluates the defaults expressions only when there is a length mismatch between the input arrays, whereas SBE always evaluates them.
MongoDB Enterprise > db.zip.insert({_id: 1, arr1: [1, 2, 3], arr2: [4, 5, 6], val1: 1, val2: -1})
WriteResult({ "nInserted" : 1 })
MongoDB Enterprise > db.zip.aggregate({$addFields: {comp: {$zip: {inputs: ["$arr1", "$arr2"], useLongestLength: true, defaults: [{$sqrt: "$val1"}, {$sqrt: "$val2"}]}}}})
If $arr1 and $arr2 had different lengths, then Classic would evaluate defaults and trigger the $sqrt error. With equal lengths, Classic skips evaluating defaults, allowing the query to succeed, but SBE still fails.
- is related to
-
SERVER-59434 Audit expressions for argument type checking errors and preemptively ignore SBE/classic engine differences in the fuzzers
-
- Closed
-
-
SERVER-109510 Investigate whether $zip in SBE can evaluate the 'defaults' parameter lazily
-
- Backlog
-