[SERVER-63012] Initialize $add with no operands to zero when translating to SBE Created: 26/Jan/22  Updated: 29/Oct/23  Resolved: 27/Jan/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.0, 5.2.1

Type: Bug Priority: Major - P3
Reporter: Eric Cox (Inactive) Assignee: Eric Cox (Inactive)
Resolution: Fixed Votes: 0
Labels: sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-62287 Fix disabled Query Execution tests fa... Closed
Related
is related to SERVER-63017 Fix SBE translation of variadic expre... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.2, v5.1
Steps To Reproduce:

db.c.insert({_id: 0, x: 1})
db.c.aggregate([{$project: {z: {$add: []}}}])

Sprint: QE 2022-02-07
Participants:
Linked BF Score: 191

 Description   

This was flagged by the agg optimization fuzzer and I was able to boil down the failing pipeline to just an $add with no args [].

The classic engine returns 0 as an int in this case so this fix will do the same during sbe translation of $add.



 Comments   
Comment by Githook User [ 27/Jan/22 ]

Author:

{'name': 'Eric Cox', 'email': 'eric.cox@mongodb.com', 'username': 'ericox'}

Message: SERVER-63012 Initialize '$add' with no operands to zero when translating to SBE

(cherry picked from commit 9b3c10f0baba2522c37db5dfdb1d41c78522c20b)
Branch: v5.2
https://github.com/mongodb/mongo/commit/657a5af1c22609dba692a28f8995b77e26be88d7

Comment by Githook User [ 26/Jan/22 ]

Author:

{'name': 'Eric Cox', 'email': 'eric.cox@mongodb.com', 'username': 'ericox'}

Message: SERVER-63012 Initialize '$add' with no operands to zero when translating to SBE
Branch: master
https://github.com/mongodb/mongo/commit/9b3c10f0baba2522c37db5dfdb1d41c78522c20b

Generated at Thu Feb 08 05:56:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.