This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 6b890f093d9 [fix](decimalv2) avoid crashing caused by decimalv2 
arithmetic with check_overflow_for_decimal enabled(#28219) (#28225)
6b890f093d9 is described below

commit 6b890f093d9fb83178aa4384902bf18104dab0da
Author: Jerry Hu <[email protected]>
AuthorDate: Tue Dec 12 21:02:38 2023 +0800

    [fix](decimalv2) avoid crashing caused by decimalv2 arithmetic with 
check_overflow_for_decimal enabled(#28219) (#28225)
---
 be/src/vec/functions/function_binary_arithmetic.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/be/src/vec/functions/function_binary_arithmetic.h 
b/be/src/vec/functions/function_binary_arithmetic.h
index c303503eb78..81097d37d19 100644
--- a/be/src/vec/functions/function_binary_arithmetic.h
+++ b/be/src/vec/functions/function_binary_arithmetic.h
@@ -954,6 +954,8 @@ public:
         }
 
         bool check_overflow_for_decimal = 
context->check_overflow_for_decimal();
+        auto status = Status::RuntimeError("{}'s arguments do not match the 
expected data types",
+                                           get_name());
         bool valid = cast_both_types(
                 left_generic, right_generic, result_generic,
                 [&](const auto& left, const auto& right, const auto& res) {
@@ -971,6 +973,13 @@ public:
                                                         
(IsDataTypeDecimal<LeftDataType> ||
                                                          
IsDataTypeDecimal<RightDataType>))) {
                         if (check_overflow_for_decimal) {
+                            if constexpr ((IsDecimalV2<typename 
LeftDataType::FieldType> ||
+                                           IsDecimalV2<typename RightDataType::
+                                                               
FieldType>)&&!is_to_null_type) {
+                                status = 
Status::Error<ErrorCode::NOT_IMPLEMENTED_ERROR>(
+                                        "cannot check overflow with 
decimalv2");
+                                return false;
+                            }
                             auto column_result = ConstOrVectorAdapter<
                                     LeftDataType, RightDataType,
                                     
std::conditional_t<IsDataTypeDecimal<ExpectedResultDataType>,
@@ -1000,8 +1009,7 @@ public:
                     return false;
                 });
         if (!valid) {
-            return Status::RuntimeError("{}'s arguments do not match the 
expected data types",
-                                        get_name());
+            return status;
         }
 
         return Status::OK();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to