taiyang-li commented on code in PR #8351:
URL: https://github.com/apache/incubator-gluten/pull/8351#discussion_r1905633000


##########
cpp-ch/local-engine/Functions/SparkFunctionCheckDecimalOverflow.cpp:
##########
@@ -204,38 +220,29 @@ class FunctionCheckDecimalOverflow : public IFunction
             return convertDecimalsImpl<DataTypeDecimal<Decimal128>, 
ToDataType>(value, precision_to, scale_from, scale_to, result);
         else if constexpr (std::is_same_v<FromFieldType, Decimal256>)
             return convertDecimalsImpl<DataTypeDecimal<Decimal256>, 
ToDataType>(value, precision_to, scale_from, scale_to, result);
-        else if constexpr (IsDataTypeNumber<FromDataType>)
-            return convertNumberToDecimalImpl<DataTypeNumber<FromFieldType>, 
ToDataType>(value, precision_to, scale_to, result);
+        else if constexpr (IsDataTypeNumber<FromDataType> && 
!std::is_same_v<FromFieldType, BFloat16>)
+            return convertNumberToDecimalImpl<DataTypeNumber<FromFieldType>, 
ToDataType>(value, scale_to, decimal_int_part_max, decimal_int_part_min, 
result);
         else
             throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Convert from {} type 
to decimal type is not implemented.", typeid(value).name());
     }
 
     template <typename FromDataType, typename ToDataType>
     requires(IsDataTypeNumber<FromDataType> && IsDataTypeDecimal<ToDataType>)
-    static bool convertNumberToDecimalImpl(
+    static inline bool convertNumberToDecimalImpl(
         const typename FromDataType::FieldType & value,
-        UInt32 precision,
         UInt32 scale,
+        Int64 decimal_int_part_max,

Review Comment:
   It is not enough to represent min/max value. Consider precision = 38 and 
scale = 0.  



-- 
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]

Reply via email to