[Bug](DecimalV3) fix decimalv3 functions (#19801)

This commit is contained in:
Gabriel
2023-05-19 14:10:01 +08:00
committed by GitHub
parent fcffb1d3de
commit c4900eb658
4 changed files with 93 additions and 18 deletions

View File

@ -64,8 +64,7 @@ namespace doris::vectorized {
// space-saving algorithm
template <typename T>
struct AggregateFunctionTopNData {
using ColVecType =
std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<Decimal128>, ColumnVector<T>>;
using ColVecType = std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<T>, ColumnVector<T>>;
void set_paramenters(int input_top_num, int space_expand_rate = 50) {
top_num = input_top_num;
capacity = (uint64_t)top_num * space_expand_rate;
@ -231,8 +230,7 @@ struct AggregateFunctionTopNImplIntInt {
//for topn_array agg
template <typename T, bool has_default_param>
struct AggregateFunctionTopNImplArray {
using ColVecType =
std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<Decimal128>, ColumnVector<T>>;
using ColVecType = std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<T>, ColumnVector<T>>;
static void add(AggregateFunctionTopNData<T>& __restrict place, const IColumn** columns,
size_t row_num) {
if constexpr (has_default_param) {
@ -256,8 +254,7 @@ struct AggregateFunctionTopNImplArray {
//for topn_weighted agg
template <typename T, bool has_default_param>
struct AggregateFunctionTopNImplWeight {
using ColVecType =
std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<Decimal128>, ColumnVector<T>>;
using ColVecType = std::conditional_t<IsDecimalNumber<T>, ColumnDecimal<T>, ColumnVector<T>>;
static void add(AggregateFunctionTopNData<T>& __restrict place, const IColumn** columns,
size_t row_num) {
if constexpr (has_default_param) {

View File

@ -159,7 +159,8 @@ public:
DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
DataTypePtr type = nullptr;
get_least_supertype(DataTypes {arguments[1], arguments[2]}, &type);
DCHECK_NE(type, nullptr);
DCHECK_NE(type, nullptr) << " arguments[1]: " << arguments[1]->get_name()
<< " arguments[2]: " << arguments[2]->get_name();
return type;
}