[fix](vectorization) Vectorization decimal arithmetic inconsistent (#8626)

This commit is contained in:
wangbo
2022-03-28 10:12:39 +08:00
committed by GitHub
parent 39717a85a2
commit 726eaa68ea
2 changed files with 8 additions and 6 deletions

View File

@ -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;

View File

@ -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) {