[bug](decimal) Use max value as result if overflow (#23602)

* [bug](decimal) Use max value as result if overflow

* update
This commit is contained in:
Gabriel
2023-08-29 13:26:25 +08:00
committed by GitHub
parent 93db9b455a
commit 7dcde4d529
4 changed files with 59 additions and 7 deletions

View File

@ -459,7 +459,7 @@ private:
NativeResultType res;
// TODO handle overflow gracefully
if (Op::template apply<NativeResultType>(a, b, res)) {
res = max_decimal_value<ResultType>();
res = type_limit<ResultType>::max();
}
return res;
} else {
@ -499,7 +499,7 @@ private:
// TODO handle overflow gracefully
if (overflow) {
LOG(WARNING) << "Decimal math overflow";
res = max_decimal_value<ResultType>();
res = type_limit<ResultType>::max();
}
} else {
res = apply(a, b);