-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
Service Arch
-
ALL
-
It seems like there’s a mismatch between the type that the IDL uses to support longs (int64_t) and the type that the BSON library uses internally (long long) that shows up when trying to add long as a component with a variant.
I think this is due to a known mismatch in our codebase between long long used in the BSON library and int64_t used outside of it. My guess is that it’s not able to do an implicit cast through the variant implicit constructor.
A possible solution is to add an explicit cast from long long to int64_t when generating the parsing code for variant types, so that the line in the generated file reads:
_min = (int64_t) element._numberLong();
long long is defined as being at least 64 bits, and considering it's representing NumberLong BSONType here which is defined as being a 64-bit integer, I believe it is safe to cast the output of element._numberLong() to int64_t.
AC: Investigate whether this modification exposes any unexpected behavior on esoteric architectures, and also do some thinking of whether this change is a good idea at all. Themes include investigating the interaction between BSON and the IDL library, and potential upgrade/downgrade concerns. We could follow up with Storage Execution, who owns BSON more generally.