[Enhancement](optimize) optimize for function multiply on decimalv2 (#13049)

optimize for function multiply on decimalv2
This commit is contained in:
Pxl
2022-10-04 16:07:18 +08:00
committed by GitHub
parent 0dd2fb758c
commit db89b0b703
2 changed files with 33 additions and 4 deletions

View File

@ -20,6 +20,9 @@
#pragma once
#include <type_traits>
#include "runtime/decimalv2_value.h"
#include "vec/columns/column_const.h"
#include "vec/columns/column_decimal.h"
#include "vec/columns/column_nullable.h"
@ -241,9 +244,13 @@ struct DecimalBinaryOperation {
}
}
/// default: use it if no return before
for (size_t i = 0; i < size; ++i) {
c[i] = apply(a[i], b[i]);
if constexpr (OpTraits::is_multiply && std::is_same_v<A, Decimal128> &&
std::is_same_v<B, Decimal128>) {
Op::vector_vector(a, b, c);
} else {
for (size_t i = 0; i < size; i++) {
c[i] = apply(a[i], b[i]);
}
}
}