HappenLee commented on code in PR #18903:
URL: https://github.com/apache/doris/pull/18903#discussion_r1173752840
##########
be/src/olap/types.h:
##########
@@ -899,7 +899,15 @@ struct FieldTypeTraits<FieldType::OLAP_FIELD_TYPE_LARGEINT>
uint128_t abs_value = value;
if (value < 0) {
*(current++) = '-';
- abs_value = -value;
+ if (value == std::numeric_limits<int128_t>::min()) {
+ //runtime error: negation of 0x 80000000 00000000 00000000
00000000 cannot be represented in type '__int128';
+ //cast to an unsigned type to negate this value to itself
+ //so if value is the minimum of negative, Unable to
directly convert to positive numbers
+ abs_value = std::numeric_limits<int128_t>::max();
Review Comment:
seems `abs_value + 1` will overflow
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]