This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch dev-1.0.1 in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit d1cf9978702ab60871293bce923a4a7dbe6d9fb9 Author: wangbo <wan...@apache.org> AuthorDate: Mon Mar 28 10:12:39 2022 +0800 [fix](vectorization) Vectorization decimal arithmetic inconsistent (#8626) --- be/src/vec/functions/divide.cpp | 8 ++++++++ be/src/vec/functions/function_binary_arithmetic.h | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/be/src/vec/functions/divide.cpp b/be/src/vec/functions/divide.cpp index f08f947..71de120 100644 --- a/be/src/vec/functions/divide.cpp +++ b/be/src/vec/functions/divide.cpp @@ -24,11 +24,19 @@ namespace doris::vectorized { +static const DecimalV2Value one(1, 0); + template <typename A, typename B> struct DivideFloatingImpl { using ResultType = typename NumberTraits::ResultOfFloatingPointDivision<A, B>::Type; static const constexpr bool allow_decimal = true; + template <typename Result = DecimalV2Value> + static inline DecimalV2Value apply(DecimalV2Value a, DecimalV2Value b, NullMap& null_map, size_t index) { + null_map[index] = b.is_zero(); + return a / (b.is_zero() ? one : b); + } + template <typename Result = ResultType> static inline Result apply(A a, B b, NullMap& null_map, size_t index) { null_map[index] = b == 0; diff --git a/be/src/vec/functions/function_binary_arithmetic.h b/be/src/vec/functions/function_binary_arithmetic.h index da1cabb..dd36158 100644 --- a/be/src/vec/functions/function_binary_arithmetic.h +++ b/be/src/vec/functions/function_binary_arithmetic.h @@ -205,12 +205,6 @@ struct DecimalBinaryOperation { ResultType scale_a [[maybe_unused]], ResultType scale_b [[maybe_unused]], NullMap& null_map) { size_t size = a.size(); - if constexpr (is_division && IsDecimalNumber<B>) { - for (size_t i = 0; i < size; ++i) { - c[i] = apply_scaled_div(a[i], b[i], scale_a, null_map, i); - } - return; - } /// default: use it if no return before for (size_t i = 0; i < size; ++i) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org