BiteTheDDDDt commented on code in PR #23677:
URL: https://github.com/apache/doris/pull/23677#discussion_r1310222374


##########
be/src/vec/data_types/data_type_decimal.cpp:
##########
@@ -210,6 +210,64 @@ Decimal128I 
DataTypeDecimal<Decimal128I>::get_scale_multiplier(UInt32 scale) {
     return common::exp10_i128(scale);
 }
 
+template <typename T>
+typename T::NativeType max_decimal_value(UInt32 precision) {
+    return 0;
+}
+template <>
+Int32 max_decimal_value<Decimal32>(UInt32 precision) {
+    return 999999999 / DataTypeDecimal<Decimal32>::get_scale_multiplier(
+                               (UInt32)(max_decimal_precision<Decimal32>() - 
precision));
+}
+template <>
+Int64 max_decimal_value<Decimal64>(UInt32 precision) {
+    return 999999999999999999 / 
DataTypeDecimal<Decimal64>::get_scale_multiplier(
+                                        
(UInt64)max_decimal_precision<Decimal64>() - precision);
+}
+template <>
+Int128 max_decimal_value<Decimal128>(UInt32 precision) {
+    return (static_cast<int128_t>(999999999999999999ll) * 100000000000000000ll 
* 1000ll +
+            static_cast<int128_t>(99999999999999999ll) * 1000ll + 999ll) /
+           DataTypeDecimal<Decimal128>::get_scale_multiplier(
+                   (UInt64)max_decimal_precision<Decimal128>() - precision);
+}
+template <>
+Int128 max_decimal_value<Decimal128I>(UInt32 precision) {
+    return (static_cast<int128_t>(999999999999999999ll) * 100000000000000000ll 
* 1000ll +

Review Comment:
   use type_limit



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to