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

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

The following commit(s) were added to refs/heads/master by this push:
     new 64cf64d1f8 remove unused code and opt int_div (#8966)
64cf64d1f8 is described below

commit 64cf64d1f858d50eb752bd340bcbbac00176be7d
Author: Pxl <952130...@qq.com>
AuthorDate: Wed Apr 13 09:51:01 2022 +0800

    remove unused code and opt int_div (#8966)
---
 be/src/vec/functions/int_div.h | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/be/src/vec/functions/int_div.h b/be/src/vec/functions/int_div.h
index a74ecab413..1bfebcb538 100644
--- a/be/src/vec/functions/int_div.h
+++ b/be/src/vec/functions/int_div.h
@@ -20,21 +20,11 @@
 
 #pragma once
 
-#include "common/compiler_util.h"
-#include "common/logging.h"
-#include "common/status.h"
-#include "runtime/decimalv2_value.h"
-#include "type_traits"
 #include "vec/columns/column_nullable.h"
-#include "vec/common/exception.h"
 #include "vec/data_types/number_traits.h"
 
 namespace doris::vectorized {
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#pragma GCC diagnostic pop
-
 template <typename A, typename B>
 struct DivideIntegralImpl {
     using ResultType = typename NumberTraits::ResultOfIntegerDivision<A, 
B>::Type;
@@ -42,14 +32,7 @@ struct DivideIntegralImpl {
     template <typename Result = ResultType>
     static inline Result apply(A a, B b, NullMap& null_map, size_t index) {
         null_map[index] = b == 0;
-
-        /// Otherwise overflow may occur due to integer promotion. Example: 
int8_t(-1) / uint64_t(2).
-        /// NOTE: overflow is still possible when dividing large signed number 
to large unsigned number or vice-versa. But it's less harmful.
-        if constexpr (std::is_integral_v<A> && std::is_integral_v<B> &&
-                      (std::is_signed_v<A> || std::is_signed_v<B>))
-            return std::make_signed_t<A>(a) / (std::make_signed_t<B>(b) + (b 
== 0));
-        else
-            return a / (b + (b == 0));
+        return a / (b + null_map[index]);
     }
 };
 


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

Reply via email to