[SERVER-62111] Inconsistent results between SBE and Classical engines for queries with $dateAdd on invalid inputs Created: 16/Dec/21 Updated: 27/Oct/23 Resolved: 17/Dec/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | Irina Yatsenko (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Operating System: | ALL | ||||
| Steps To Reproduce: | collection: {_id:0} query: Results: sbe: "code" : 5075301, "errmsg" : "Executor error during find command :: caused by :: $indexOfCP substring must resolve to a string" |
||||
| Sprint: | QE 2021-12-27 | ||||
| Participants: | |||||
| Linked BF Score: | 141 | ||||
| Comments |
| Comment by Irina Yatsenko (Inactive) [ 17/Dec/21 ] |
|
That is, the difference in behavior in this ticket is by design. Relaxing the fuzzers to take this into account has been fixed per TIG-3637. |
| Comment by Irina Yatsenko (Inactive) [ 17/Dec/21 ] |
|
It has been decided in prior similar precedents that the following should be SBE's canonical behavior: This means that occasionally it's possible for a query to succeed in one engine and fail in another and this shouldn't be considered a bug. |
| Comment by Irina Yatsenko (Inactive) [ 16/Dec/21 ] |
|
Note, if the projection clause is modified to {x: {$dateAdd: {startDate: new Date(), unit: "second", amount: {$indexOfCP: ["foo", "$str", 0]},}}}, the classic engine starts returning "errmsg" : "Executor error during find command :: caused by :: $indexOfCP requires a string as the second argument, found: missing", so I suspect, when the field for startDate is missing, the classic engine doesn't evaluate the `amount` but SBE still does... Confirmed: in ExpressionDateArithmetics::evaluate() the startDate is evaluated first, and if missing it returns immediately w/o evaluating the rest of the args. |