[SERVER-62888] $multiply in SBE promotes integer to decimal type on overflow Created: 21/Jan/22  Updated: 29/Oct/23  Resolved: 26/Apr/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc1

Type: Bug Priority: Major - P3
Reporter: Irina Yatsenko (Inactive) Assignee: Ivan Fefer
Resolution: Fixed Votes: 0
Labels: 7.1-Type-Precision-Fixes
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: QE 2022-02-07, QE 2022-02-21
Participants:
Linked BF Score: 35

 Description   

Currently, in SBE we promote integer types to decimal on overflow, while in the classical engine we promote to double. There are arguments to support either of the behaviors as well as arguments to never promote. Waiting for a spec (ksuarz@gmail.com) that would describe what should be done on integer overflow in $add, $subtract, $mulitple, $inc, $sum et al.



 Comments   
Comment by Githook User [ 28/Apr/23 ]

Author:

{'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}

Message: SERVER-62888 Promote int64 to double on overflow in SBE
Branch: v7.0
https://github.com/mongodb/mongo/commit/293e1c3ed27d170289c3fd4ca2e4530e7d905863

Comment by Githook User [ 26/Apr/23 ]

Author:

{'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}

Message: SERVER-62888 Promote int64 to double on overflow in SBE
Branch: master
https://github.com/mongodb/mongo/commit/f31ee2ac4cc4b94cb3b80462e5ebba194f452a4c

Comment by Rushan Chen [ 05/Apr/23 ]

As agreed in discussion and documented in WRITING-10039, the behavior to use when overflowing from int64 is to coerce the result type to double. This ticket should fix all int64 overflow cases in the operators mentioned.

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