diff --git a/be/src/exec/schema_scanner.cpp b/be/src/exec/schema_scanner.cpp index 8d640341bf..a905f69336 100644 --- a/be/src/exec/schema_scanner.cpp +++ b/be/src/exec/schema_scanner.cpp @@ -275,13 +275,13 @@ Status SchemaScanner::fill_dest_column_for_range(vectorized::Block* block, size_ case TYPE_DECIMALV2: { const vectorized::Int128 num = (reinterpret_cast(data))->value; - reinterpret_cast(col_ptr)->insert_data( + reinterpret_cast(col_ptr)->insert_data( reinterpret_cast(&num), 0); break; } case TYPE_DECIMAL128I: { const vectorized::Int128 num = (reinterpret_cast(data))->value; - reinterpret_cast(col_ptr)->insert_data( + reinterpret_cast(col_ptr)->insert_data( reinterpret_cast(&num), 0); break; } diff --git a/be/src/runtime/primitive_type.h b/be/src/runtime/primitive_type.h index 4c36ac21bf..6040f73388 100644 --- a/be/src/runtime/primitive_type.h +++ b/be/src/runtime/primitive_type.h @@ -208,7 +208,7 @@ struct PrimitiveTypeTraits { using CppType = DecimalV2Value; /// Different with compute layer, the DecimalV1 was stored as decimal12_t(12 bytes). using StorageFieldType = decimal12_t; - using ColumnType = vectorized::ColumnDecimal; + using ColumnType = vectorized::ColumnDecimal; }; template <> struct PrimitiveTypeTraits { @@ -224,9 +224,9 @@ struct PrimitiveTypeTraits { }; template <> struct PrimitiveTypeTraits { - using CppType = vectorized::Decimal128I; + using CppType = vectorized::Decimal128V3; using StorageFieldType = vectorized::Int128; - using ColumnType = vectorized::ColumnDecimal; + using ColumnType = vectorized::ColumnDecimal; }; template <> struct PrimitiveTypeTraits { diff --git a/be/src/runtime/runtime_predicate.h b/be/src/runtime/runtime_predicate.h index 9e3bce17d6..80742fa66d 100644 --- a/be/src/runtime/runtime_predicate.h +++ b/be/src/runtime/runtime_predicate.h @@ -148,9 +148,9 @@ private: static std::string get_decimalv2_value(const Field& field) { // can NOT use PrimitiveTypeTraits::CppType since - // it is DecimalV2Value and Decimal128 can not convert to it implicitly - using ValueType = Decimal128::NativeType; - auto v = field.get>(); + // it is DecimalV2Value and Decimal128V2 can not convert to it implicitly + using ValueType = Decimal128V2::NativeType; + auto v = field.get>(); // use TYPE_DECIMAL128I instead of TYPE_DECIMALV2 since v.get_scale() // is always 9 for DECIMALV2 return cast_to_string(v.get_value(), v.get_scale()); @@ -170,7 +170,7 @@ private: static std::string get_decimal128_value(const Field& field) { using ValueType = typename PrimitiveTypeTraits::CppType; - auto v = field.get>(); + auto v = field.get>(); return cast_to_string(v.get_value(), v.get_scale()); } diff --git a/be/src/runtime/type_limit.h b/be/src/runtime/type_limit.h index be3b2186d1..f1f08caf43 100644 --- a/be/src/runtime/type_limit.h +++ b/be/src/runtime/type_limit.h @@ -54,18 +54,18 @@ struct type_limit { }; template <> -struct type_limit { - static vectorized::Decimal128I max() { +struct type_limit { + static vectorized::Decimal128V3 max() { return (static_cast(999999999999999999ll) * 100000000000000000ll * 1000ll + static_cast(99999999999999999ll) * 1000ll + 999ll); } - static vectorized::Decimal128I min() { return -max(); } + static vectorized::Decimal128V3 min() { return -max(); } }; template <> -struct type_limit { - static vectorized::Decimal128 max() { return DecimalV2Value::get_max_decimal().value(); } - static vectorized::Decimal128 min() { return -max(); } +struct type_limit { + static vectorized::Decimal128V2 max() { return DecimalV2Value::get_max_decimal().value(); } + static vectorized::Decimal128V2 min() { return -max(); } }; static wide::Int256 MAX_DECIMAL256_INT({18446744073709551615ul, 8607968719199866879ul, 532749306367912313ul, 1593091911132452277ul}); diff --git a/be/src/util/arrow/block_convertor.cpp b/be/src/util/arrow/block_convertor.cpp index 2c605c9c96..009306d425 100644 --- a/be/src/util/arrow/block_convertor.cpp +++ b/be/src/util/arrow/block_convertor.cpp @@ -178,7 +178,7 @@ public: size_t start = _cur_start; size_t num_rows = _cur_rows; if (auto* decimalv2_column = vectorized::check_and_get_column< - vectorized::ColumnDecimal>( + vectorized::ColumnDecimal>( *vectorized::remove_nullable(_cur_col))) { std::shared_ptr s_decimal_ptr = std::make_shared(27, 9); @@ -198,7 +198,7 @@ public: } return arrow::Status::OK(); } else if (auto* decimal128_column = vectorized::check_and_get_column< - vectorized::ColumnDecimal>( + vectorized::ColumnDecimal>( *vectorized::remove_nullable(_cur_col))) { std::shared_ptr s_decimal_ptr = std::make_shared(38, decimal128_column->get_scale()); diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.h b/be/src/vec/aggregate_functions/aggregate_function_avg.h index b2d95db679..61eb04bb13 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_avg.h +++ b/be/src/vec/aggregate_functions/aggregate_function_avg.h @@ -85,7 +85,7 @@ struct AggregateFunctionAvgData { DecimalV2Value decimal_val_count(count, 0); DecimalV2Value decimal_val_sum(sum); DecimalV2Value cal_ret = decimal_val_sum / decimal_val_count; - Decimal128 ret(cal_ret.value()); + Decimal128V2 ret(cal_ret.value()); return ret; } else { if constexpr (IsDecimal256) { @@ -113,15 +113,15 @@ class AggregateFunctionAvg final : public IAggregateFunctionDataHelper> { public: using ResultType = std::conditional_t< - IsDecimalV2, Decimal128, + IsDecimalV2, Decimal128V2, std::conditional_t, typename Data::ResultType, Float64>>; using ResultDataType = std::conditional_t< - IsDecimalV2, DataTypeDecimal, + IsDecimalV2, DataTypeDecimal, std::conditional_t, DataTypeDecimal, DataTypeNumber>>; using ColVecType = std::conditional_t, ColumnDecimal, ColumnVector>; using ColVecResult = std::conditional_t< - IsDecimalV2, ColumnDecimal, + IsDecimalV2, ColumnDecimal, std::conditional_t, ColumnDecimal, ColumnVector>>; diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index a1a8a346e9..295a063bc3 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -56,7 +56,7 @@ namespace doris::vectorized { template struct AggregateFunctionHistogramData { using ColVecType = - std::conditional_t, ColumnDecimal, ColumnVector>; + std::conditional_t, ColumnDecimal, ColumnVector>; void set_parameters(int input_max_num_buckets) { if (input_max_num_buckets > 0) { diff --git a/be/src/vec/aggregate_functions/aggregate_function_product.h b/be/src/vec/aggregate_functions/aggregate_function_product.h index 8a13ad0b03..4b0365a1b6 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_product.h +++ b/be/src/vec/aggregate_functions/aggregate_function_product.h @@ -51,43 +51,43 @@ struct AggregateFunctionProductData { }; template <> -struct AggregateFunctionProductData { - Decimal128 product {}; +struct AggregateFunctionProductData { + Decimal128V2 product {}; - void add(Decimal128 value, Decimal128) { + void add(Decimal128V2 value, Decimal128V2) { DecimalV2Value decimal_product(product); DecimalV2Value decimal_value(value); DecimalV2Value ret = decimal_product * decimal_value; - memcpy(&product, &ret, sizeof(Decimal128)); + memcpy(&product, &ret, sizeof(Decimal128V2)); } - void merge(const AggregateFunctionProductData& other, Decimal128) { + void merge(const AggregateFunctionProductData& other, Decimal128V2) { DecimalV2Value decimal_product(product); DecimalV2Value decimal_value(other.product); DecimalV2Value ret = decimal_product * decimal_value; - memcpy(&product, &ret, sizeof(Decimal128)); + memcpy(&product, &ret, sizeof(Decimal128V2)); } void write(BufferWritable& buffer) const { write_binary(product, buffer); } void read(BufferReadable& buffer) { read_binary(product, buffer); } - Decimal128 get() const { return product; } + Decimal128V2 get() const { return product; } - void reset(Decimal128 value) { product = std::move(value); } + void reset(Decimal128V2 value) { product = std::move(value); } }; template <> -struct AggregateFunctionProductData { - Decimal128I product {}; +struct AggregateFunctionProductData { + Decimal128V3 product {}; template - void add(Decimal value, Decimal128I multiplier) { + void add(Decimal value, Decimal128V3 multiplier) { product *= value; product /= multiplier; } - void merge(const AggregateFunctionProductData& other, Decimal128I multiplier) { + void merge(const AggregateFunctionProductData& other, Decimal128V3 multiplier) { product *= other.product; product /= multiplier; } @@ -96,9 +96,9 @@ struct AggregateFunctionProductData { void read(BufferReadable& buffer) { read_binary(product, buffer); } - Decimal128 get() const { return product; } + Decimal128V2 get() const { return product; } - void reset(Decimal128 value) { product = value; } + void reset(Decimal128V2 value) { product = value; } }; template diff --git a/be/src/vec/aggregate_functions/aggregate_function_stddev.h b/be/src/vec/aggregate_functions/aggregate_function_stddev.h index 9578b37fbc..c84e67a7d6 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_stddev.h +++ b/be/src/vec/aggregate_functions/aggregate_function_stddev.h @@ -214,7 +214,7 @@ struct BaseDatadecimal { } static DataTypePtr get_return_type() { - return std::make_shared>(27, 9); + return std::make_shared>(27, 9); } DecimalV2Value mean; @@ -224,7 +224,7 @@ struct BaseDatadecimal { template struct PopData : Data { - using ColVecResult = std::conditional_t, ColumnDecimal, + using ColVecResult = std::conditional_t, ColumnDecimal, ColumnVector>; void insert_result_into(IColumn& to) const { auto& col = assert_cast(to); @@ -258,7 +258,7 @@ struct StddevSampName : Data { template struct SampData : Data { - using ColVecResult = std::conditional_t, ColumnDecimal, + using ColVecResult = std::conditional_t, ColumnDecimal, ColumnVector>; void insert_result_into(IColumn& to) const { ColumnNullable& nullable_column = assert_cast(to); diff --git a/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp b/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp index 97b0fba623..735b8a737c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp @@ -48,11 +48,11 @@ AggregateFunctionPtr create_aggregate_function_uniq(const std::string& name, } else if (which.is_decimal64()) { return creator_without_type::create>>( argument_types, result_is_nullable); - } else if (which.is_decimal128i()) { - return creator_without_type::create>>( + } else if (which.is_decimal128v3()) { + return creator_without_type::create>>( argument_types, result_is_nullable); - } else if (which.is_decimal128() || which.is_decimal128i()) { - return creator_without_type::create>>( + } else if (which.is_decimal128v2() || which.is_decimal128v3()) { + return creator_without_type::create>>( argument_types, result_is_nullable); } else if (which.is_string_or_fixed_string()) { return creator_without_type::create>>( diff --git a/be/src/vec/aggregate_functions/helpers.h b/be/src/vec/aggregate_functions/helpers.h index 63b814e3e6..9bea4e7453 100644 --- a/be/src/vec/aggregate_functions/helpers.h +++ b/be/src/vec/aggregate_functions/helpers.h @@ -44,8 +44,8 @@ #define FOR_DECIMAL_TYPES(M) \ M(Decimal32) \ M(Decimal64) \ - M(Decimal128) \ - M(Decimal128I) \ + M(Decimal128V2) \ + M(Decimal128V3) \ M(Decimal256) /** If the serialized type is not the default type(string), diff --git a/be/src/vec/columns/column_array.h b/be/src/vec/columns/column_array.h index 222e8a911c..ad8edbf756 100644 --- a/be/src/vec/columns/column_array.h +++ b/be/src/vec/columns/column_array.h @@ -51,10 +51,10 @@ class Arena; } // namespace doris //TODO: use marcos below to decouple array function calls -#define ALL_COLUMNS_NUMBER \ - ColumnUInt8, ColumnInt8, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt128, ColumnFloat32, \ - ColumnFloat64, ColumnDecimal32, ColumnDecimal64, ColumnDecimal128I, ColumnDecimal128, \ - ColumnDecimal256 +#define ALL_COLUMNS_NUMBER \ + ColumnUInt8, ColumnInt8, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt128, ColumnFloat32, \ + ColumnFloat64, ColumnDecimal32, ColumnDecimal64, ColumnDecimal128V3, \ + ColumnDecimal128V2, ColumnDecimal256 #define ALL_COLUMNS_TIME ColumnDate, ColumnDateTime, ColumnDateV2, ColumnDateTimeV2 #define ALL_COLUMNS_NUMERIC ALL_COLUMNS_NUMBER, ALL_COLUMNS_TIME #define ALL_COLUMNS_SIMPLE ALL_COLUMNS_NUMERIC, ColumnString diff --git a/be/src/vec/columns/column_decimal.cpp b/be/src/vec/columns/column_decimal.cpp index 1158e5b0d6..ed76ce6a11 100644 --- a/be/src/vec/columns/column_decimal.cpp +++ b/be/src/vec/columns/column_decimal.cpp @@ -494,12 +494,12 @@ Decimal64 ColumnDecimal::get_scale_multiplier() const { } template <> -Decimal128 ColumnDecimal::get_scale_multiplier() const { +Decimal128V2 ColumnDecimal::get_scale_multiplier() const { return common::exp10_i128(scale); } template <> -Decimal128I ColumnDecimal::get_scale_multiplier() const { +Decimal128V3 ColumnDecimal::get_scale_multiplier() const { return common::exp10_i128(scale); } @@ -529,7 +529,7 @@ void ColumnDecimal::replace_column_null_data(const uint8_t* __restrict null_m template class ColumnDecimal; template class ColumnDecimal; -template class ColumnDecimal; -template class ColumnDecimal; +template class ColumnDecimal; +template class ColumnDecimal; template class ColumnDecimal; } // namespace doris::vectorized diff --git a/be/src/vec/columns/columns_number.h b/be/src/vec/columns/columns_number.h index 926db2d47c..33dbe4c8c6 100644 --- a/be/src/vec/columns/columns_number.h +++ b/be/src/vec/columns/columns_number.h @@ -53,8 +53,8 @@ using ColumnFloat64 = ColumnVector; using ColumnDecimal32 = ColumnDecimal; using ColumnDecimal64 = ColumnDecimal; -using ColumnDecimal128 = ColumnDecimal; -using ColumnDecimal128I = ColumnDecimal; +using ColumnDecimal128V2 = ColumnDecimal; +using ColumnDecimal128V3 = ColumnDecimal; using ColumnDecimal256 = ColumnDecimal; using ColumnIPv4 = ColumnVector; diff --git a/be/src/vec/common/field_visitors.h b/be/src/vec/common/field_visitors.h index 2066a94960..9e41be40ac 100644 --- a/be/src/vec/common/field_visitors.h +++ b/be/src/vec/common/field_visitors.h @@ -59,10 +59,10 @@ typename std::decay_t::ResultType apply_visitor(Visitor&& visitor, F&& return visitor(field.template get>()); case Field::Types::Decimal64: return visitor(field.template get>()); - case Field::Types::Decimal128: - return visitor(field.template get>()); - case Field::Types::Decimal128I: - return visitor(field.template get>()); + case Field::Types::Decimal128V2: + return visitor(field.template get>()); + case Field::Types::Decimal128V3: + return visitor(field.template get>()); case Field::Types::Decimal256: return visitor(field.template get>()); case Field::Types::JSONB: diff --git a/be/src/vec/core/call_on_type_index.h b/be/src/vec/core/call_on_type_index.h index 30ad31f356..b651fe2ec4 100644 --- a/be/src/vec/core/call_on_type_index.h +++ b/be/src/vec/core/call_on_type_index.h @@ -68,10 +68,10 @@ bool call_on_basic_type(TypeIndex number, F&& f) { return f(TypePair()); case TypeIndex::Decimal64: return f(TypePair()); - case TypeIndex::Decimal128: - return f(TypePair()); - case TypeIndex::Decimal128I: - return f(TypePair()); + case TypeIndex::Decimal128V2: + return f(TypePair()); + case TypeIndex::Decimal128V3: + return f(TypePair()); case TypeIndex::Decimal256: return f(TypePair()); default: @@ -139,11 +139,11 @@ bool call_on_basic_types(TypeIndex type_num1, TypeIndex type_num2, F&& f) { case TypeIndex::Decimal64: return call_on_basic_type( type_num2, std::forward(f)); - case TypeIndex::Decimal128: - return call_on_basic_type( + case TypeIndex::Decimal128V2: + return call_on_basic_type( type_num2, std::forward(f)); - case TypeIndex::Decimal128I: - return call_on_basic_type( + case TypeIndex::Decimal128V3: + return call_on_basic_type( type_num2, std::forward(f)); case TypeIndex::Decimal256: return call_on_basic_type( @@ -218,10 +218,10 @@ bool call_on_index_and_data_type(TypeIndex number, F&& f) { return f(TypePair, T>()); case TypeIndex::Decimal64: return f(TypePair, T>()); - case TypeIndex::Decimal128: - return f(TypePair, T>()); - case TypeIndex::Decimal128I: - return f(TypePair, T>()); + case TypeIndex::Decimal128V2: + return f(TypePair, T>()); + case TypeIndex::Decimal128V3: + return f(TypePair, T>()); case TypeIndex::Decimal256: return f(TypePair, T>()); @@ -280,10 +280,10 @@ bool call_on_index_and_number_data_type(TypeIndex number, F&& f) { return f(TypePair, T>()); case TypeIndex::Decimal64: return f(TypePair, T>()); - case TypeIndex::Decimal128: - return f(TypePair, T>()); - case TypeIndex::Decimal128I: - return f(TypePair, T>()); + case TypeIndex::Decimal128V2: + return f(TypePair, T>()); + case TypeIndex::Decimal128V3: + return f(TypePair, T>()); case TypeIndex::Decimal256: return f(TypePair, T>()); default: diff --git a/be/src/vec/core/field.cpp b/be/src/vec/core/field.cpp index 337c2c395f..8cb07f27c7 100644 --- a/be/src/vec/core/field.cpp +++ b/be/src/vec/core/field.cpp @@ -127,8 +127,8 @@ void write_binary(const Array& x, BufferWritable& buf) { } template <> -Decimal128I DecimalField::get_scale_multiplier() const { - return DataTypeDecimal::get_scale_multiplier(scale); +Decimal128V3 DecimalField::get_scale_multiplier() const { + return DataTypeDecimal::get_scale_multiplier(scale); } template @@ -169,19 +169,19 @@ bool dec_less_or_equal(T x, T y, UInt32 x_scale, UInt32 y_scale) { DECLARE_DECIMAL_COMPARISON(Decimal32) DECLARE_DECIMAL_COMPARISON(Decimal64) -DECLARE_DECIMAL_COMPARISON(Decimal128) +DECLARE_DECIMAL_COMPARISON(Decimal128V2) DECLARE_DECIMAL_COMPARISON(Decimal256) template <> -bool decimal_equal(Decimal128I x, Decimal128I y, UInt32 xs, UInt32 ys) { - return dec_equal(Decimal128(x.value), Decimal128(y.value), xs, ys); +bool decimal_equal(Decimal128V3 x, Decimal128V3 y, UInt32 xs, UInt32 ys) { + return dec_equal(Decimal128V2(x.value), Decimal128V2(y.value), xs, ys); } template <> -bool decimal_less(Decimal128I x, Decimal128I y, UInt32 xs, UInt32 ys) { - return dec_less(Decimal128(x.value), Decimal128(y.value), xs, ys); +bool decimal_less(Decimal128V3 x, Decimal128V3 y, UInt32 xs, UInt32 ys) { + return dec_less(Decimal128V2(x.value), Decimal128V2(y.value), xs, ys); } template <> -bool decimal_less_or_equal(Decimal128I x, Decimal128I y, UInt32 xs, UInt32 ys) { - return dec_less_or_equal(Decimal128(x.value), Decimal128(y.value), xs, ys); +bool decimal_less_or_equal(Decimal128V3 x, Decimal128V3 y, UInt32 xs, UInt32 ys) { + return dec_less_or_equal(Decimal128V2(x.value), Decimal128V2(y.value), xs, ys); } } // namespace doris::vectorized diff --git a/be/src/vec/core/field.h b/be/src/vec/core/field.h index 752e8356ab..15de84589f 100644 --- a/be/src/vec/core/field.h +++ b/be/src/vec/core/field.h @@ -71,22 +71,22 @@ struct AvgNearestFieldTypeTrait { template <> struct AvgNearestFieldTypeTrait { - using Type = Decimal128I; + using Type = Decimal128V3; }; template <> struct AvgNearestFieldTypeTrait { - using Type = Decimal128I; + using Type = Decimal128V3; }; template <> -struct AvgNearestFieldTypeTrait { - using Type = Decimal128; +struct AvgNearestFieldTypeTrait { + using Type = Decimal128V2; }; template <> -struct AvgNearestFieldTypeTrait { - using Type = Decimal128I; +struct AvgNearestFieldTypeTrait { + using Type = Decimal128V3; }; template <> @@ -115,12 +115,12 @@ struct AvgNearestFieldTypeTrait256 { }; template <> -struct AvgNearestFieldTypeTrait256 { - using Type = Decimal128; +struct AvgNearestFieldTypeTrait256 { + using Type = Decimal128V2; }; template <> -struct AvgNearestFieldTypeTrait256 { +struct AvgNearestFieldTypeTrait256 { using Type = Decimal256; }; @@ -349,10 +349,10 @@ public: Tuple = 18, Decimal32 = 19, Decimal64 = 20, - Decimal128 = 21, + Decimal128V2 = 21, AggregateFunctionState = 22, JSONB = 23, - Decimal128I = 24, + Decimal128V3 = 24, Map = 25, VariantMap = 26, Bitmap = 27, @@ -392,10 +392,10 @@ public: return "Decimal32"; case Decimal64: return "Decimal64"; - case Decimal128: - return "Decimal128"; - case Decimal128I: - return "Decimal128I"; + case Decimal128V2: + return "Decimal128V2"; + case Decimal128V3: + return "Decimal128V3"; case Decimal256: return "Decimal256"; case FixedLengthObject: @@ -422,8 +422,8 @@ public: struct EnumToType; static bool is_decimal(Types::Which which) { - return (which >= Types::Decimal32 && which <= Types::Decimal128) || - which == Types::Decimal128I || which == Types::Decimal256; + return (which >= Types::Decimal32 && which <= Types::Decimal128V2) || + which == Types::Decimal128V3 || which == Types::Decimal256; } Field() : which(Types::Null) {} @@ -590,10 +590,10 @@ public: return get() <=> rhs.get(); case Types::Decimal64: return get() <=> rhs.get(); - case Types::Decimal128: - return get() <=> rhs.get(); - case Types::Decimal128I: - return get() <=> rhs.get(); + case Types::Decimal128V2: + return get() <=> rhs.get(); + case Types::Decimal128V3: + return get() <=> rhs.get(); case Types::Decimal256: return get() <=> rhs.get(); default: @@ -646,11 +646,11 @@ public: case Types::Decimal64: f(field.template get>()); return; - case Types::Decimal128: - f(field.template get>()); + case Types::Decimal128V2: + f(field.template get>()); return; - case Types::Decimal128I: - f(field.template get>()); + case Types::Decimal128V3: + f(field.template get>()); return; case Types::Decimal256: f(field.template get>()); @@ -676,9 +676,9 @@ public: private: std::aligned_union_t, DecimalField, DecimalField, - DecimalField, DecimalField, BitmapValue, - HyperLogLog, QuantileState> + DecimalField, DecimalField, + DecimalField, DecimalField, + DecimalField, BitmapValue, HyperLogLog, QuantileState> storage; Types::Which which; @@ -795,12 +795,12 @@ struct TypeId> { static constexpr const TypeIndex value = TypeIndex::Decimal64; }; template <> -struct TypeId> { - static constexpr const TypeIndex value = TypeIndex::Decimal128; +struct TypeId> { + static constexpr const TypeIndex value = TypeIndex::Decimal128V2; }; template <> -struct TypeId> { - static constexpr const TypeIndex value = TypeIndex::Decimal128I; +struct TypeId> { + static constexpr const TypeIndex value = TypeIndex::Decimal128V3; }; template <> struct TypeId> { @@ -863,12 +863,12 @@ struct Field::TypeToEnum> { static constexpr Types::Which value = Types::Decimal64; }; template <> -struct Field::TypeToEnum> { - static constexpr Types::Which value = Types::Decimal128; +struct Field::TypeToEnum> { + static constexpr Types::Which value = Types::Decimal128V2; }; template <> -struct Field::TypeToEnum> { - static constexpr Types::Which value = Types::Decimal128I; +struct Field::TypeToEnum> { + static constexpr Types::Which value = Types::Decimal128V3; }; template <> struct Field::TypeToEnum> { @@ -947,12 +947,12 @@ struct Field::EnumToType { using Type = DecimalField; }; template <> -struct Field::EnumToType { - using Type = DecimalField; +struct Field::EnumToType { + using Type = DecimalField; }; template <> -struct Field::EnumToType { - using Type = DecimalField; +struct Field::EnumToType { + using Type = DecimalField; }; template <> struct Field::EnumToType { @@ -1051,12 +1051,12 @@ struct NearestFieldTypeImpl { using Type = DecimalField; }; template <> -struct NearestFieldTypeImpl { - using Type = DecimalField; +struct NearestFieldTypeImpl { + using Type = DecimalField; }; template <> -struct NearestFieldTypeImpl { - using Type = DecimalField; +struct NearestFieldTypeImpl { + using Type = DecimalField; }; template <> struct NearestFieldTypeImpl { @@ -1071,12 +1071,12 @@ struct NearestFieldTypeImpl> { using Type = DecimalField; }; template <> -struct NearestFieldTypeImpl> { - using Type = DecimalField; +struct NearestFieldTypeImpl> { + using Type = DecimalField; }; template <> -struct NearestFieldTypeImpl> { - using Type = DecimalField; +struct NearestFieldTypeImpl> { + using Type = DecimalField; }; template <> struct NearestFieldTypeImpl> { diff --git a/be/src/vec/core/types.h b/be/src/vec/core/types.h index aca679c910..82bc67a8fc 100644 --- a/be/src/vec/core/types.h +++ b/be/src/vec/core/types.h @@ -72,7 +72,7 @@ enum class TypeIndex { Enum16 = 18, Decimal32 = 19, Decimal64 = 20, - Decimal128 = 21, + Decimal128V2 = 21, UUID = 22, Array = 23, Tuple = 24, @@ -89,7 +89,7 @@ enum class TypeIndex { TimeV2 = 35, FixedLengthObject = 36, JSONB = 37, - Decimal128I = 38, + Decimal128V3 = 38, Map = 39, Struct = 40, VARIANT = 41, @@ -650,11 +650,11 @@ inline Decimal operator%(const Decimal& x, const Decimal& y) { return Decimal(x.value % y.value); } -struct Decimal128I : public Decimal { - Decimal128I() = default; +struct Decimal128V3 : public Decimal { + Decimal128V3() = default; #define DECLARE_NUMERIC_CTOR(TYPE) \ - Decimal128I(const TYPE& value_) : Decimal(value_) {} + Decimal128V3(const TYPE& value_) : Decimal(value_) {} DECLARE_NUMERIC_CTOR(wide::Int256) DECLARE_NUMERIC_CTOR(Int128) @@ -667,14 +667,14 @@ struct Decimal128I : public Decimal { #undef DECLARE_NUMERIC_CTOR template - Decimal128I(const Decimal& x) { + Decimal128V3(const Decimal& x) { value = x; } }; using Decimal32 = Decimal; using Decimal64 = Decimal; -using Decimal128 = Decimal; +using Decimal128V2 = Decimal; using Decimal256 = Decimal; inline bool operator<(const Decimal256& x, const Decimal256& y) { @@ -699,12 +699,12 @@ struct TypeName { static const char* get() { return "Decimal64"; } }; template <> -struct TypeName { - static const char* get() { return "Decimal128"; } +struct TypeName { + static const char* get() { return "Decimal128V2"; } }; template <> -struct TypeName { - static const char* get() { return "Decimal128I"; } +struct TypeName { + static const char* get() { return "Decimal128V3"; } }; template <> @@ -721,12 +721,12 @@ struct TypeId { static constexpr const TypeIndex value = TypeIndex::Decimal64; }; template <> -struct TypeId { - static constexpr const TypeIndex value = TypeIndex::Decimal128; +struct TypeId { + static constexpr const TypeIndex value = TypeIndex::Decimal128V2; }; template <> -struct TypeId { - static constexpr const TypeIndex value = TypeIndex::Decimal128I; +struct TypeId { + static constexpr const TypeIndex value = TypeIndex::Decimal128V3; }; template <> struct TypeId { @@ -740,21 +740,21 @@ inline constexpr bool IsDecimalNumber = true; template <> inline constexpr bool IsDecimalNumber = true; template <> -inline constexpr bool IsDecimalNumber = true; +inline constexpr bool IsDecimalNumber = true; template <> -inline constexpr bool IsDecimalNumber = true; +inline constexpr bool IsDecimalNumber = true; template <> inline constexpr bool IsDecimalNumber = true; template -constexpr bool IsDecimal128 = false; +constexpr bool IsDecimal128V2 = false; template <> -inline constexpr bool IsDecimal128 = true; +inline constexpr bool IsDecimal128V2 = true; template -constexpr bool IsDecimal128I = false; +constexpr bool IsDecimal128V3 = false; template <> -inline constexpr bool IsDecimal128I = true; +inline constexpr bool IsDecimal128V3 = true; template constexpr bool IsDecimal256 = false; @@ -762,14 +762,14 @@ template <> inline constexpr bool IsDecimal256 = true; template -constexpr bool IsDecimalV2 = IsDecimal128 && !IsDecimal128I; +constexpr bool IsDecimalV2 = IsDecimal128V2 && !IsDecimal128V3; template -using DisposeDecimal = std::conditional_t, Decimal128, - std::conditional_t, Decimal128I, U>>; +using DisposeDecimal = std::conditional_t, Decimal128V2, + std::conditional_t, Decimal128V3, U>>; template -using DisposeDecimal256 = std::conditional_t, Decimal128, +using DisposeDecimal256 = std::conditional_t, Decimal128V2, std::conditional_t, Decimal256, U>>; template @@ -792,11 +792,11 @@ struct NativeType { using Type = Int64; }; template <> -struct NativeType { +struct NativeType { using Type = Int128; }; template <> -struct NativeType { +struct NativeType { using Type = Int128; }; template <> @@ -860,10 +860,10 @@ inline const char* getTypeName(TypeIndex idx) { return TypeName::get(); case TypeIndex::Decimal64: return TypeName::get(); - case TypeIndex::Decimal128: - return TypeName::get(); - case TypeIndex::Decimal128I: - return TypeName::get(); + case TypeIndex::Decimal128V2: + return TypeName::get(); + case TypeIndex::Decimal128V3: + return TypeName::get(); case TypeIndex::Decimal256: return TypeName::get(); case TypeIndex::UUID: @@ -919,8 +919,8 @@ struct std::hash> { }; template <> -struct std::hash { - size_t operator()(const doris::vectorized::Decimal128& x) const { +struct std::hash { + size_t operator()(const doris::vectorized::Decimal128V2& x) const { return std::hash()(x.value >> 64) ^ std::hash()( x.value & std::numeric_limits::max()); @@ -928,8 +928,8 @@ struct std::hash { }; template <> -struct std::hash { - size_t operator()(const doris::vectorized::Decimal128I& x) const { +struct std::hash { + size_t operator()(const doris::vectorized::Decimal128V3& x) const { return std::hash()(x.value >> 64) ^ std::hash()( x.value & std::numeric_limits::max()); diff --git a/be/src/vec/data_types/convert_field_to_type.cpp b/be/src/vec/data_types/convert_field_to_type.cpp index 13e1ce6292..0196d5ede7 100644 --- a/be/src/vec/data_types/convert_field_to_type.cpp +++ b/be/src/vec/data_types/convert_field_to_type.cpp @@ -89,11 +89,11 @@ public: LOG(FATAL) << "not implemeted"; __builtin_unreachable(); } - [[noreturn]] String operator()(const DecimalField& x) const { + [[noreturn]] String operator()(const DecimalField& x) const { LOG(FATAL) << "not implemeted"; __builtin_unreachable(); } - [[noreturn]] String operator()(const DecimalField& x) const { + [[noreturn]] String operator()(const DecimalField& x) const { LOG(FATAL) << "not implemeted"; __builtin_unreachable(); } @@ -135,10 +135,10 @@ public: void operator()(const DecimalField& x, JsonbWriter* writer) const { throw doris::Exception(doris::ErrorCode::NOT_IMPLEMENTED_ERROR, "Not implemeted"); } - void operator()(const DecimalField& x, JsonbWriter* writer) const { + void operator()(const DecimalField& x, JsonbWriter* writer) const { throw doris::Exception(doris::ErrorCode::NOT_IMPLEMENTED_ERROR, "Not implemeted"); } - void operator()(const DecimalField& x, JsonbWriter* writer) const { + void operator()(const DecimalField& x, JsonbWriter* writer) const { throw doris::Exception(doris::ErrorCode::NOT_IMPLEMENTED_ERROR, "Not implemeted"); } void operator()(const DecimalField& x, JsonbWriter* writer) const { diff --git a/be/src/vec/data_types/data_type.cpp b/be/src/vec/data_types/data_type.cpp index 0db189262b..e1c12d429f 100644 --- a/be/src/vec/data_types/data_type.cpp +++ b/be/src/vec/data_types/data_type.cpp @@ -139,9 +139,9 @@ PGenericType_TypeId IDataType::get_pdata_type(const IDataType* data_type) { return PGenericType::DECIMAL32; case TypeIndex::Decimal64: return PGenericType::DECIMAL64; - case TypeIndex::Decimal128: + case TypeIndex::Decimal128V2: return PGenericType::DECIMAL128; - case TypeIndex::Decimal128I: + case TypeIndex::Decimal128V3: return PGenericType::DECIMAL128I; case TypeIndex::Decimal256: return PGenericType::DECIMAL256; diff --git a/be/src/vec/data_types/data_type.h b/be/src/vec/data_types/data_type.h index 3bcc9b064f..06082f0095 100644 --- a/be/src/vec/data_types/data_type.h +++ b/be/src/vec/data_types/data_type.h @@ -266,11 +266,11 @@ struct WhichDataType { bool is_decimal32() const { return idx == TypeIndex::Decimal32; } bool is_decimal64() const { return idx == TypeIndex::Decimal64; } - bool is_decimal128() const { return idx == TypeIndex::Decimal128; } - bool is_decimal128i() const { return idx == TypeIndex::Decimal128I; } + bool is_decimal128v2() const { return idx == TypeIndex::Decimal128V2; } + bool is_decimal128v3() const { return idx == TypeIndex::Decimal128V3; } bool is_decimal256() const { return idx == TypeIndex::Decimal256; } bool is_decimal() const { - return is_decimal32() || is_decimal64() || is_decimal128() || is_decimal128i() || + return is_decimal32() || is_decimal64() || is_decimal128v2() || is_decimal128v3() || is_decimal256(); } @@ -326,7 +326,7 @@ inline bool is_decimal(const DataTypePtr& data_type) { return WhichDataType(data_type).is_decimal(); } inline bool is_decimal_v2(const DataTypePtr& data_type) { - return WhichDataType(data_type).is_decimal128(); + return WhichDataType(data_type).is_decimal128v2(); } inline bool is_tuple(const DataTypePtr& data_type) { return WhichDataType(data_type).is_tuple(); diff --git a/be/src/vec/data_types/data_type_decimal.cpp b/be/src/vec/data_types/data_type_decimal.cpp index 20e444fb0e..bec9847d0a 100644 --- a/be/src/vec/data_types/data_type_decimal.cpp +++ b/be/src/vec/data_types/data_type_decimal.cpp @@ -150,7 +150,7 @@ Field DataTypeDecimal::get_default() const { template MutableColumnPtr DataTypeDecimal::create_column() const { if constexpr (IsDecimalV2) { - auto col = ColumnDecimal128::create(0, scale); + auto col = ColumnDecimal128V2::create(0, scale); return col; } else { return ColumnType::create(0, scale); @@ -167,7 +167,7 @@ bool DataTypeDecimal::parse_from_string(const std::string& str, T* res) const DataTypePtr create_decimal(UInt64 precision_value, UInt64 scale_value, bool use_v2) { auto max_precision = - use_v2 ? max_decimal_precision() : max_decimal_precision(); + use_v2 ? max_decimal_precision() : max_decimal_precision(); if (precision_value < min_decimal_precision() || precision_value > max_precision) { throw doris::Exception(doris::ErrorCode::NOT_IMPLEMENTED_ERROR, "Wrong precision {}, min: {}, max: {}", precision_value, @@ -182,15 +182,15 @@ DataTypePtr create_decimal(UInt64 precision_value, UInt64 scale_value, bool use_ } if (use_v2) { - return std::make_shared>(precision_value, scale_value); + return std::make_shared>(precision_value, scale_value); } if (precision_value <= max_decimal_precision()) { return std::make_shared>(precision_value, scale_value); } else if (precision_value <= max_decimal_precision()) { return std::make_shared>(precision_value, scale_value); - } else if (precision_value <= max_decimal_precision()) { - return std::make_shared>(precision_value, scale_value); + } else if (precision_value <= max_decimal_precision()) { + return std::make_shared>(precision_value, scale_value); } return std::make_shared>(precision_value, scale_value); } @@ -206,12 +206,12 @@ Decimal64 DataTypeDecimal::get_scale_multiplier(UInt32 scale) { } template <> -Decimal128 DataTypeDecimal::get_scale_multiplier(UInt32 scale) { +Decimal128V2 DataTypeDecimal::get_scale_multiplier(UInt32 scale) { return common::exp10_i128(scale); } template <> -Decimal128I DataTypeDecimal::get_scale_multiplier(UInt32 scale) { +Decimal128V3 DataTypeDecimal::get_scale_multiplier(UInt32 scale) { return common::exp10_i128(scale); } @@ -229,11 +229,11 @@ Decimal64 DataTypeDecimal::get_max_digits_number(UInt32 digit_count) return common::max_i64(digit_count); } template <> -Decimal128 DataTypeDecimal::get_max_digits_number(UInt32 digit_count) { +Decimal128V2 DataTypeDecimal::get_max_digits_number(UInt32 digit_count) { return common::max_i128(digit_count); } template <> -Decimal128I DataTypeDecimal::get_max_digits_number(UInt32 digit_count) { +Decimal128V3 DataTypeDecimal::get_max_digits_number(UInt32 digit_count) { return common::max_i128(digit_count); } template <> @@ -244,8 +244,8 @@ Decimal256 DataTypeDecimal::get_max_digits_number(UInt32 digit_count /// Explicit template instantiations. template class DataTypeDecimal; template class DataTypeDecimal; -template class DataTypeDecimal; -template class DataTypeDecimal; +template class DataTypeDecimal; +template class DataTypeDecimal; template class DataTypeDecimal; } // namespace doris::vectorized diff --git a/be/src/vec/data_types/data_type_decimal.h b/be/src/vec/data_types/data_type_decimal.h index 68d48e393b..234078ad4c 100644 --- a/be/src/vec/data_types/data_type_decimal.h +++ b/be/src/vec/data_types/data_type_decimal.h @@ -86,11 +86,11 @@ constexpr size_t max_decimal_precision() { return BeConsts::MAX_DECIMAL64_PRECISION; } template <> -constexpr size_t max_decimal_precision() { +constexpr size_t max_decimal_precision() { return BeConsts::MAX_DECIMALV2_PRECISION; } template <> -constexpr size_t max_decimal_precision() { +constexpr size_t max_decimal_precision() { return BeConsts::MAX_DECIMAL128_PRECISION; } template <> @@ -160,7 +160,7 @@ public: desc = TypeDescriptor(TYPE_DECIMAL32); } else if constexpr (std::is_same_v, TypeId>) { desc = TypeDescriptor(TYPE_DECIMAL64); - } else if constexpr (std::is_same_v, TypeId>) { + } else if constexpr (std::is_same_v, TypeId>) { desc = TypeDescriptor(TYPE_DECIMAL128I); } else if constexpr (std::is_same_v, TypeId>) { desc = TypeDescriptor(TYPE_DECIMAL256); @@ -179,7 +179,7 @@ public: if constexpr (std::is_same_v, TypeId>) { return doris::FieldType::OLAP_FIELD_TYPE_DECIMAL64; } - if constexpr (std::is_same_v, TypeId>) { + if constexpr (std::is_same_v, TypeId>) { return doris::FieldType::OLAP_FIELD_TYPE_DECIMAL128I; } if constexpr (std::is_same_v, TypeId>) { @@ -201,11 +201,11 @@ public: DCHECK_EQ(node.node_type, TExprNodeType::DECIMAL_LITERAL); DCHECK(node.__isset.decimal_literal); // decimalv2 - if constexpr (std::is_same_v, TypeId>) { + if constexpr (std::is_same_v, TypeId>) { DecimalV2Value value; if (value.parse_from_str(node.decimal_literal.value.c_str(), node.decimal_literal.value.size()) == E_DEC_OK) { - return DecimalField(value.value(), value.scale()); + return DecimalField(value.value(), value.scale()); } else { throw doris::Exception(doris::ErrorCode::INVALID_ARGUMENT, "Invalid decimal(scale: {}) value: {}", value.scale(), @@ -364,10 +364,10 @@ inline UInt32 get_decimal_scale(const IDataType& data_type, UInt32 default_value if (auto* decimal_type = check_decimal(data_type)) { return decimal_type->get_scale(); } - if (auto* decimal_type = check_decimal(data_type)) { + if (auto* decimal_type = check_decimal(data_type)) { return decimal_type->get_scale(); } - if (auto* decimal_type = check_decimal(data_type)) { + if (auto* decimal_type = check_decimal(data_type)) { return decimal_type->get_scale(); } if (auto* decimal_type = check_decimal(data_type)) { @@ -385,21 +385,21 @@ inline constexpr bool IsDataTypeDecimal> = true; template <> inline constexpr bool IsDataTypeDecimal> = true; template <> -inline constexpr bool IsDataTypeDecimal> = true; +inline constexpr bool IsDataTypeDecimal> = true; template <> -inline constexpr bool IsDataTypeDecimal> = true; +inline constexpr bool IsDataTypeDecimal> = true; template <> inline constexpr bool IsDataTypeDecimal> = true; template constexpr bool IsDataTypeDecimalV2 = false; template <> -inline constexpr bool IsDataTypeDecimalV2> = true; +inline constexpr bool IsDataTypeDecimalV2> = true; template -constexpr bool IsDataTypeDecimal128I = false; +constexpr bool IsDataTypeDecimal128V3 = false; template <> -inline constexpr bool IsDataTypeDecimal128I> = true; +inline constexpr bool IsDataTypeDecimal128V3> = true; template constexpr bool IsDataTypeDecimal256 = false; @@ -499,9 +499,9 @@ void convert_decimal_cols( using ToFieldType = typename ToDataType::FieldType; using MaxFieldType = std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && - (std::is_same_v || - std::is_same_v), - Decimal128I, + (std::is_same_v || + std::is_same_v), + Decimal128V3, std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), FromFieldType, ToFieldType>>; using MaxNativeType = typename MaxFieldType::NativeType; @@ -657,7 +657,7 @@ void convert_to_decimal(typename ToDataType::FieldType* dst, } } else { using DecimalFrom = - std::conditional_t, Decimal128, + std::conditional_t, Decimal128V2, std::conditional_t, Decimal256, Decimal64>>; convert_to_decimals, ToDataType, multiply_may_overflow, diff --git a/be/src/vec/data_types/data_type_factory.cpp b/be/src/vec/data_types/data_type_factory.cpp index fc31712817..d349fffe99 100644 --- a/be/src/vec/data_types/data_type_factory.cpp +++ b/be/src/vec/data_types/data_type_factory.cpp @@ -188,7 +188,7 @@ DataTypePtr DataTypeFactory::create_data_type(const TypeDescriptor& col_desc, bo nested = std::make_shared(); break; case TYPE_DECIMALV2: - nested = std::make_shared>(27, 9); + nested = std::make_shared>(27, 9); break; case TYPE_QUANTILE_STATE: nested = std::make_shared(); @@ -311,13 +311,13 @@ DataTypePtr DataTypeFactory::create_data_type(const TypeIndex& type_index, bool case TypeIndex::Decimal64: nested = std::make_shared>(BeConsts::MAX_DECIMAL64_PRECISION, 0); break; - case TypeIndex::Decimal128: - nested = std::make_shared>(BeConsts::MAX_DECIMAL128_PRECISION, - 0); + case TypeIndex::Decimal128V2: + nested = std::make_shared>(BeConsts::MAX_DECIMALV2_PRECISION, + 0); break; - case TypeIndex::Decimal128I: - nested = std::make_shared>(BeConsts::MAX_DECIMAL128_PRECISION, - 0); + case TypeIndex::Decimal128V3: + nested = std::make_shared>(BeConsts::MAX_DECIMAL128_PRECISION, + 0); break; case TypeIndex::Decimal256: nested = std::make_shared>(BeConsts::MAX_DECIMAL256_PRECISION, @@ -414,7 +414,7 @@ DataTypePtr DataTypeFactory::_create_primitive_data_type(const FieldType& type, result = std::make_shared(); break; case FieldType::OLAP_FIELD_TYPE_DECIMAL: - result = std::make_shared>(27, 9); + result = std::make_shared>(27, 9); break; case FieldType::OLAP_FIELD_TYPE_QUANTILE_STATE: result = std::make_shared(); @@ -508,12 +508,12 @@ DataTypePtr DataTypeFactory::create_data_type(const PColumnMeta& pcolumn) { pcolumn.decimal_param().scale()); break; case PGenericType::DECIMAL128: - nested = std::make_shared>(pcolumn.decimal_param().precision(), - pcolumn.decimal_param().scale()); + nested = std::make_shared>( + pcolumn.decimal_param().precision(), pcolumn.decimal_param().scale()); break; case PGenericType::DECIMAL128I: - nested = std::make_shared>(pcolumn.decimal_param().precision(), - pcolumn.decimal_param().scale()); + nested = std::make_shared>( + pcolumn.decimal_param().precision(), pcolumn.decimal_param().scale()); break; case PGenericType::DECIMAL256: nested = std::make_shared>(pcolumn.decimal_param().precision(), @@ -667,7 +667,7 @@ DataTypePtr DataTypeFactory::create_data_type(const arrow::DataType* type, bool nested = std::make_shared(); break; case ::arrow::Type::DECIMAL: - nested = std::make_shared>(); + nested = std::make_shared>(); break; case ::arrow::Type::LIST: DCHECK(type->num_fields() == 1); diff --git a/be/src/vec/data_types/get_least_supertype.cpp b/be/src/vec/data_types/get_least_supertype.cpp index 1baf463b05..49c5bacce1 100644 --- a/be/src/vec/data_types/get_least_supertype.cpp +++ b/be/src/vec/data_types/get_least_supertype.cpp @@ -394,8 +394,8 @@ void get_least_supertype(const DataTypes& types, DataTypePtr* type) { { UInt32 have_decimal32 = type_ids.count(TypeIndex::Decimal32); UInt32 have_decimal64 = type_ids.count(TypeIndex::Decimal64); - UInt32 have_decimal128 = type_ids.count(TypeIndex::Decimal128); - UInt32 have_decimal128i = type_ids.count(TypeIndex::Decimal128I); + UInt32 have_decimal128 = type_ids.count(TypeIndex::Decimal128V2); + UInt32 have_decimal128i = type_ids.count(TypeIndex::Decimal128V3); UInt32 have_decimal256 = type_ids.count(TypeIndex::Decimal256); if (have_decimal32 || have_decimal64 || have_decimal128 || have_decimal128i || @@ -452,19 +452,19 @@ void get_least_supertype(const DataTypes& types, DataTypePtr* type) { type); } - if (have_decimal256 || min_precision > DataTypeDecimal::max_precision()) { + if (have_decimal256 || min_precision > DataTypeDecimal::max_precision()) { *type = std::make_shared>( DataTypeDecimal::max_precision(), max_scale); return; } if (have_decimal128 || min_precision > DataTypeDecimal::max_precision()) { - *type = std::make_shared>( - DataTypeDecimal::max_precision(), max_scale); + *type = std::make_shared>( + DataTypeDecimal::max_precision(), max_scale); return; } if (have_decimal128i || min_precision > DataTypeDecimal::max_precision()) { - *type = std::make_shared>( - DataTypeDecimal::max_precision(), max_scale); + *type = std::make_shared>( + DataTypeDecimal::max_precision(), max_scale); return; } if (have_decimal64 || min_precision > DataTypeDecimal::max_precision()) { diff --git a/be/src/vec/data_types/serde/data_type_decimal_serde.cpp b/be/src/vec/data_types/serde/data_type_decimal_serde.cpp index 65b504474f..3d5c10ff01 100644 --- a/be/src/vec/data_types/serde/data_type_decimal_serde.cpp +++ b/be/src/vec/data_types/serde/data_type_decimal_serde.cpp @@ -107,7 +107,7 @@ void DataTypeDecimalSerDe::write_column_to_arrow(const IColumn& column, const array_builder->type()->name()); } // TODO: decimal256 - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { std::shared_ptr s_decimal_ptr = std::make_shared(38, col.get_scale()); for (size_t i = start; i < end; ++i) { @@ -172,18 +172,19 @@ void DataTypeDecimalSerDe::read_column_from_arrow(IColumn& column, if constexpr (std::is_same_v>) { // TODO check precision for (size_t value_i = start; value_i < end; ++value_i) { - auto value = *reinterpret_cast( + auto value = *reinterpret_cast( concrete_array->Value(value_i)); // convert scale to 9; if (9 > arrow_scale) { - using MaxNativeType = typename Decimal128::NativeType; + using MaxNativeType = typename Decimal128V2::NativeType; MaxNativeType converted_value = common::exp10_i128(9 - arrow_scale); if (common::mul_overflow(static_cast(value), converted_value, converted_value)) { VLOG_DEBUG << "Decimal convert overflow"; value = converted_value < 0 - ? std::numeric_limits::min() - : std::numeric_limits::max(); + ? std::numeric_limits::min() + : std::numeric_limits< + typename Decimal128V2 ::NativeType>::max(); } else { value = converted_value; } @@ -192,7 +193,7 @@ void DataTypeDecimalSerDe::read_column_from_arrow(IColumn& column, } column_data.emplace_back(value); } - } else if constexpr (std::is_same_v || std::is_same_v || + } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { for (size_t value_i = start; value_i < end; ++value_i) { column_data.emplace_back(*reinterpret_cast(concrete_array->Value(value_i))); @@ -246,7 +247,7 @@ Status DataTypeDecimalSerDe::write_column_to_orc(const std::string& timezone, std::vector& buffer_list) const { auto& col_data = assert_cast&>(column).get_data(); - if constexpr (IsDecimal128 || IsDecimal128I) { + if constexpr (IsDecimal128V2 || IsDecimal128V3) { orc::Decimal128VectorBatch* cur_batch = dynamic_cast(orc_col_batch); @@ -274,8 +275,8 @@ Status DataTypeDecimalSerDe::write_column_to_orc(const std::string& timezone, template class DataTypeDecimalSerDe; template class DataTypeDecimalSerDe; -template class DataTypeDecimalSerDe; -template class DataTypeDecimalSerDe; +template class DataTypeDecimalSerDe; +template class DataTypeDecimalSerDe; template class DataTypeDecimalSerDe; } // namespace vectorized } // namespace doris diff --git a/be/src/vec/data_types/serde/data_type_decimal_serde.h b/be/src/vec/data_types/serde/data_type_decimal_serde.h index 57cbc30651..347e17ada1 100644 --- a/be/src/vec/data_types/serde/data_type_decimal_serde.h +++ b/be/src/vec/data_types/serde/data_type_decimal_serde.h @@ -55,10 +55,10 @@ public: if constexpr (std::is_same_v, TypeId>) { return TYPE_DECIMAL64; } - if constexpr (std::is_same_v, TypeId>) { + if constexpr (std::is_same_v, TypeId>) { return TYPE_DECIMAL128I; } - if constexpr (std::is_same_v, TypeId>) { + if constexpr (std::is_same_v, TypeId>) { return TYPE_DECIMALV2; } if constexpr (std::is_same_v, TypeId>) { @@ -130,7 +130,7 @@ Status DataTypeDecimalSerDe::write_column_to_pb(const IColumn& column, PValue auto ptype = result.mutable_type(); if constexpr (std::is_same_v>) { ptype->set_id(PGenericType::DECIMAL128); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { ptype->set_id(PGenericType::DECIMAL128I); } else if constexpr (std::is_same_v) { ptype->set_id(PGenericType::DECIMAL256); @@ -152,7 +152,7 @@ Status DataTypeDecimalSerDe::write_column_to_pb(const IColumn& column, PValue // TODO: decimal256 template Status DataTypeDecimalSerDe::read_column_from_pb(IColumn& column, const PValues& arg) const { - if constexpr (std::is_same_v> || std::is_same_v || + if constexpr (std::is_same_v> || std::is_same_v || std::is_same_v || std::is_same_v>) { column.resize(arg.bytes_value_size()); auto& data = reinterpret_cast&>(column).get_data(); @@ -173,12 +173,12 @@ void DataTypeDecimalSerDe::write_one_cell_to_jsonb(const IColumn& column, Jso result.writeKey(col_id); // TODO: decimal256 if constexpr (std::is_same_v>) { - Decimal128::NativeType val = - *reinterpret_cast(data_ref.data); + Decimal128V2::NativeType val = + *reinterpret_cast(data_ref.data); result.writeInt128(val); - } else if constexpr (std::is_same_v) { - Decimal128I::NativeType val = - *reinterpret_cast(data_ref.data); + } else if constexpr (std::is_same_v) { + Decimal128V3::NativeType val = + *reinterpret_cast(data_ref.data); result.writeInt128(val); } else if constexpr (std::is_same_v>) { Decimal32::NativeType val = *reinterpret_cast(data_ref.data); @@ -199,7 +199,7 @@ void DataTypeDecimalSerDe::read_one_cell_from_jsonb(IColumn& column, // TODO: decimal256 if constexpr (std::is_same_v>) { col.insert_value(static_cast(arg)->val()); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { col.insert_value(static_cast(arg)->val()); } else if constexpr (std::is_same_v>) { col.insert_value(static_cast(arg)->val()); diff --git a/be/src/vec/exec/format/format_common.h b/be/src/vec/exec/format/format_common.h index 9e8ce4fe23..24664d7769 100644 --- a/be/src/vec/exec/format/format_common.h +++ b/be/src/vec/exec/format/format_common.h @@ -38,9 +38,9 @@ struct DecimalScaleParams { return common::exp10_i32(n); } else if constexpr (std::is_same_v) { return common::exp10_i64(n); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { return common::exp10_i128(n); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { return common::exp10_i128(n); } else { static_assert(!sizeof(DecimalPrimitiveType), diff --git a/be/src/vec/exec/format/orc/vorc_reader.cpp b/be/src/vec/exec/format/orc/vorc_reader.cpp index 12a889ec23..943b9d1e4d 100644 --- a/be/src/vec/exec/format/orc/vorc_reader.cpp +++ b/be/src/vec/exec/format/orc/vorc_reader.cpp @@ -1297,12 +1297,12 @@ Status OrcReader::_orc_column_to_doris_column(const std::string& col_name, case TypeIndex::Decimal64: return _decode_decimal_column(col_name, data_column, data_type, cvb, num_values); - case TypeIndex::Decimal128: - return _decode_decimal_column(col_name, data_column, data_type, cvb, - num_values); - case TypeIndex::Decimal128I: - return _decode_decimal_column(col_name, data_column, data_type, cvb, - num_values); + case TypeIndex::Decimal128V2: + return _decode_decimal_column(col_name, data_column, data_type, + cvb, num_values); + case TypeIndex::Decimal128V3: + return _decode_decimal_column(col_name, data_column, data_type, + cvb, num_values); case TypeIndex::Date: return _decode_time_column( col_name, data_column, cvb, num_values); diff --git a/be/src/vec/exec/format/parquet/parquet_column_convert.h b/be/src/vec/exec/format/parquet/parquet_column_convert.h index 65f5270fac..1b876a86ce 100644 --- a/be/src/vec/exec/format/parquet/parquet_column_convert.h +++ b/be/src/vec/exec/format/parquet/parquet_column_convert.h @@ -108,11 +108,11 @@ struct PhysicalTypeTraits { M(TypeIndex::Float32, Float32, Float32) \ M(TypeIndex::Float64, Float64, Float64) -#define FOR_LOGICAL_DECIMAL_TYPES(M) \ - M(TypeIndex::Decimal32, Decimal32, Decimal32) \ - M(TypeIndex::Decimal64, Decimal64, Decimal64) \ - M(TypeIndex::Decimal128, Decimal128, Decimal128) \ - M(TypeIndex::Decimal128I, Decimal128I, Decimal128I) +#define FOR_LOGICAL_DECIMAL_TYPES(M) \ + M(TypeIndex::Decimal32, Decimal32, Decimal32) \ + M(TypeIndex::Decimal64, Decimal64, Decimal64) \ + M(TypeIndex::Decimal128V2, Decimal128V2, Decimal128V2) \ + M(TypeIndex::Decimal128V3, Decimal128V3, Decimal128V3) struct ConvertParams { // schema.logicalType.TIMESTAMP.isAdjustedToUTC == false @@ -537,10 +537,10 @@ inline Status get_converter(tparquet::Type::type parquet_physical_type, Primitiv *converter = std::make_unique>(); break; } else if (show_type == PrimitiveType::TYPE_DECIMALV2) { - *converter = std::make_unique>(); + *converter = std::make_unique>(); break; } else if (show_type == PrimitiveType::TYPE_DECIMAL128I) { - *converter = std::make_unique>(); + *converter = std::make_unique>(); break; } diff --git a/be/src/vec/exec/format/parquet/parquet_pred_cmp.h b/be/src/vec/exec/format/parquet/parquet_pred_cmp.h index 8158fb9e9f..ae0eea44ff 100644 --- a/be/src/vec/exec/format/parquet/parquet_pred_cmp.h +++ b/be/src/vec/exec/format/parquet/parquet_pred_cmp.h @@ -163,7 +163,7 @@ private: break; case TYPE_DECIMALV2: if constexpr (std::is_same_v) { - size_t max_precision = max_decimal_precision(); + size_t max_precision = max_decimal_precision(); if (col_schema->parquet_schema.precision < 1 || col_schema->parquet_schema.precision > max_precision || col_schema->parquet_schema.scale > max_precision) { @@ -171,19 +171,19 @@ private: } int v2_scale = DecimalV2Value::SCALE; if (physical_type == tparquet::Type::FIXED_LEN_BYTE_ARRAY) { - min_value = DecimalV2Value( - _decode_binary_decimal(col_schema, encoded_min, v2_scale)); - max_value = DecimalV2Value( - _decode_binary_decimal(col_schema, encoded_max, v2_scale)); - } else if (physical_type == tparquet::Type::INT32) { - min_value = DecimalV2Value(_decode_primitive_decimal( + min_value = DecimalV2Value(_decode_binary_decimal( col_schema, encoded_min, v2_scale)); - max_value = DecimalV2Value(_decode_primitive_decimal( + max_value = DecimalV2Value(_decode_binary_decimal( + col_schema, encoded_max, v2_scale)); + } else if (physical_type == tparquet::Type::INT32) { + min_value = DecimalV2Value(_decode_primitive_decimal( + col_schema, encoded_min, v2_scale)); + max_value = DecimalV2Value(_decode_primitive_decimal( col_schema, encoded_max, v2_scale)); } else if (physical_type == tparquet::Type::INT64) { - min_value = DecimalV2Value(_decode_primitive_decimal( + min_value = DecimalV2Value(_decode_primitive_decimal( col_schema, encoded_min, v2_scale)); - max_value = DecimalV2Value(_decode_primitive_decimal( + max_value = DecimalV2Value(_decode_primitive_decimal( col_schema, encoded_max, v2_scale)); } else { return false; @@ -199,7 +199,7 @@ private: case TYPE_DECIMAL128I: if constexpr (std::is_same_v || std::is_same_v || - std::is_same_v) { + std::is_same_v) { size_t max_precision = max_decimal_precision(); if (col_schema->parquet_schema.precision < 1 || col_schema->parquet_schema.precision > max_precision || diff --git a/be/src/vec/exec/jni_connector.cpp b/be/src/vec/exec/jni_connector.cpp index 719e035f1a..59ad101597 100644 --- a/be/src/vec/exec/jni_connector.cpp +++ b/be/src/vec/exec/jni_connector.cpp @@ -44,25 +44,25 @@ class RuntimeProfile; namespace doris::vectorized { -#define FOR_FIXED_LENGTH_TYPES(M) \ - M(TypeIndex::Int8, ColumnVector, Int8) \ - M(TypeIndex::UInt8, ColumnVector, UInt8) \ - M(TypeIndex::Int16, ColumnVector, Int16) \ - M(TypeIndex::UInt16, ColumnVector, UInt16) \ - M(TypeIndex::Int32, ColumnVector, Int32) \ - M(TypeIndex::UInt32, ColumnVector, UInt32) \ - M(TypeIndex::Int64, ColumnVector, Int64) \ - M(TypeIndex::UInt64, ColumnVector, UInt64) \ - M(TypeIndex::Int128, ColumnVector, Int128) \ - M(TypeIndex::Float32, ColumnVector, Float32) \ - M(TypeIndex::Float64, ColumnVector, Float64) \ - M(TypeIndex::Decimal128, ColumnDecimal>, Int128) \ - M(TypeIndex::Decimal128I, ColumnDecimal>, Int128) \ - M(TypeIndex::Decimal32, ColumnDecimal>, Int32) \ - M(TypeIndex::Decimal64, ColumnDecimal>, Int64) \ - M(TypeIndex::Date, ColumnVector, Int64) \ - M(TypeIndex::DateV2, ColumnVector, UInt32) \ - M(TypeIndex::DateTime, ColumnVector, Int64) \ +#define FOR_FIXED_LENGTH_TYPES(M) \ + M(TypeIndex::Int8, ColumnVector, Int8) \ + M(TypeIndex::UInt8, ColumnVector, UInt8) \ + M(TypeIndex::Int16, ColumnVector, Int16) \ + M(TypeIndex::UInt16, ColumnVector, UInt16) \ + M(TypeIndex::Int32, ColumnVector, Int32) \ + M(TypeIndex::UInt32, ColumnVector, UInt32) \ + M(TypeIndex::Int64, ColumnVector, Int64) \ + M(TypeIndex::UInt64, ColumnVector, UInt64) \ + M(TypeIndex::Int128, ColumnVector, Int128) \ + M(TypeIndex::Float32, ColumnVector, Float32) \ + M(TypeIndex::Float64, ColumnVector, Float64) \ + M(TypeIndex::Decimal128V2, ColumnDecimal>, Int128) \ + M(TypeIndex::Decimal128V3, ColumnDecimal>, Int128) \ + M(TypeIndex::Decimal32, ColumnDecimal>, Int32) \ + M(TypeIndex::Decimal64, ColumnDecimal>, Int64) \ + M(TypeIndex::Date, ColumnVector, Int64) \ + M(TypeIndex::DateV2, ColumnVector, UInt32) \ + M(TypeIndex::DateTime, ColumnVector, Int64) \ M(TypeIndex::DateTimeV2, ColumnVector, UInt64) JniConnector::~JniConnector() { diff --git a/be/src/vec/functions/array/function_array_aggregation.cpp b/be/src/vec/functions/array/function_array_aggregation.cpp index 102acb9d39..e8a2fd9e95 100644 --- a/be/src/vec/functions/array/function_array_aggregation.cpp +++ b/be/src/vec/functions/array/function_array_aggregation.cpp @@ -167,8 +167,8 @@ struct ArrayAggregateImpl { execute_type(res, type, data, offsets) || execute_type(res, type, data, offsets) || execute_type(res, type, data, offsets) || - execute_type(res, type, data, offsets) || - execute_type(res, type, data, offsets) || + execute_type(res, type, data, offsets) || + execute_type(res, type, data, offsets) || execute_type(res, type, data, offsets) || execute_type(res, type, data, offsets) || execute_type(res, type, data, offsets) || diff --git a/be/src/vec/functions/array/function_array_apply.cpp b/be/src/vec/functions/array/function_array_apply.cpp index 0e9076e65e..2ad680635a 100644 --- a/be/src/vec/functions/array/function_array_apply.cpp +++ b/be/src/vec/functions/array/function_array_apply.cpp @@ -173,48 +173,48 @@ private: } // need exception safety -#define APPLY_ALL_TYPES(src_column, src_offsets, OP, cmp, dst) \ - do { \ - WhichDataType which(remove_nullable(nested_type)); \ - if (which.is_uint8()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_int8()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_int16()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_int32()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_int64()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_int128()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_float32()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_float64()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_date()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_date_time()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_date_v2()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_date_time_v2()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_date_time_v2()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_decimal32()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_decimal64()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_decimal128()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_decimal128i()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else if (which.is_decimal256()) { \ - *dst = _apply_internal(src_column, src_offsets, cmp); \ - } else { \ - LOG(FATAL) << "unsupported type " << nested_type->get_name(); \ - } \ +#define APPLY_ALL_TYPES(src_column, src_offsets, OP, cmp, dst) \ + do { \ + WhichDataType which(remove_nullable(nested_type)); \ + if (which.is_uint8()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_int8()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_int16()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_int32()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_int64()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_int128()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_float32()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_float64()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_date()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_date_time()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_date_v2()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_date_time_v2()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_date_time_v2()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_decimal32()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_decimal64()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_decimal128v2()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_decimal128v3()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else if (which.is_decimal256()) { \ + *dst = _apply_internal(src_column, src_offsets, cmp); \ + } else { \ + LOG(FATAL) << "unsupported type " << nested_type->get_name(); \ + } \ } while (0) // need exception safety diff --git a/be/src/vec/functions/array/function_array_cum_sum.cpp b/be/src/vec/functions/array/function_array_cum_sum.cpp index b3ddd0a6fe..c4ae12a72d 100644 --- a/be/src/vec/functions/array/function_array_cum_sum.cpp +++ b/be/src/vec/functions/array/function_array_cum_sum.cpp @@ -70,13 +70,13 @@ public: return_type = std::make_shared(); } else if (which.is_float32() || which.is_float64()) { return_type = std::make_shared(); - } else if (which.is_decimal128() && !which.is_decimal128i()) { + } else if (which.is_decimal128v2() && !which.is_decimal128v3()) { // decimalv2 - return_type = std::make_shared>( - DataTypeDecimal::max_precision(), scale); + return_type = std::make_shared>( + DataTypeDecimal::max_precision(), scale); } else if (which.is_decimal()) { - return_type = std::make_shared>( - DataTypeDecimal::max_precision(), scale); + return_type = std::make_shared>( + DataTypeDecimal::max_precision(), scale); } if (return_type) { return std::make_shared(make_nullable(return_type)); @@ -161,17 +161,17 @@ private: res = _execute_number(src_column, src_offsets, src_null_map, res_nested_ptr); } else if (which.is_decimal32()) { - res = _execute_number(src_column, src_offsets, src_null_map, - res_nested_ptr); + res = _execute_number(src_column, src_offsets, src_null_map, + res_nested_ptr); } else if (which.is_decimal64()) { - res = _execute_number(src_column, src_offsets, src_null_map, - res_nested_ptr); - } else if (which.is_decimal128i()) { - res = _execute_number(src_column, src_offsets, src_null_map, - res_nested_ptr); - } else if (which.is_decimal128()) { - res = _execute_number(src_column, src_offsets, src_null_map, - res_nested_ptr); + res = _execute_number(src_column, src_offsets, src_null_map, + res_nested_ptr); + } else if (which.is_decimal128v3()) { + res = _execute_number(src_column, src_offsets, src_null_map, + res_nested_ptr); + } else if (which.is_decimal128v2()) { + res = _execute_number(src_column, src_offsets, src_null_map, + res_nested_ptr); } return res; diff --git a/be/src/vec/functions/array/function_array_difference.h b/be/src/vec/functions/array/function_array_difference.h index cc2efa64bd..b078396a91 100644 --- a/be/src/vec/functions/array/function_array_difference.h +++ b/be/src/vec/functions/array/function_array_difference.h @@ -227,12 +227,12 @@ private: } else if (which_type.is_decimal64()) { res = _execute_number_expanded(offsets, *nested_column, nested_null_map); - } else if (which_type.is_decimal128i()) { - res = _execute_number_expanded(offsets, *nested_column, - nested_null_map); - } else if (which_type.is_decimal128()) { - res = _execute_number_expanded(offsets, *nested_column, - nested_null_map); + } else if (which_type.is_decimal128v3()) { + res = _execute_number_expanded(offsets, *nested_column, + nested_null_map); + } else if (which_type.is_decimal128v2()) { + res = _execute_number_expanded(offsets, *nested_column, + nested_null_map); } else if (which_type.is_decimal256()) { res = _execute_number_expanded(offsets, *nested_column, nested_null_map); diff --git a/be/src/vec/functions/array/function_array_distinct.h b/be/src/vec/functions/array/function_array_distinct.h index 7e5e0a7372..936db43544 100644 --- a/be/src/vec/functions/array/function_array_distinct.h +++ b/be/src/vec/functions/array/function_array_distinct.h @@ -301,15 +301,15 @@ private: } else if (which.is_decimal64()) { res = _execute_number(src_column, src_offsets, dest_column, dest_offsets, src_null_map, dest_null_map); - } else if (which.is_decimal128i()) { - res = _execute_number(src_column, src_offsets, dest_column, - dest_offsets, src_null_map, dest_null_map); + } else if (which.is_decimal128v3()) { + res = _execute_number(src_column, src_offsets, dest_column, + dest_offsets, src_null_map, dest_null_map); } else if (which.is_decimal256()) { res = _execute_number(src_column, src_offsets, dest_column, dest_offsets, src_null_map, dest_null_map); - } else if (which.is_decimal128()) { - res = _execute_number(src_column, src_offsets, dest_column, - dest_offsets, src_null_map, dest_null_map); + } else if (which.is_decimal128v2()) { + res = _execute_number(src_column, src_offsets, dest_column, + dest_offsets, src_null_map, dest_null_map); } else if (which.is_string()) { res = _execute_string(src_column, src_offsets, dest_column, dest_offsets, src_null_map, dest_null_map); diff --git a/be/src/vec/functions/array/function_array_element.h b/be/src/vec/functions/array/function_array_element.h index 53c7b9df3d..fef7aa3bea 100644 --- a/be/src/vec/functions/array/function_array_element.h +++ b/be/src/vec/functions/array/function_array_element.h @@ -392,12 +392,12 @@ private: } else if (which_type.is_decimal64()) { res = _execute_number(offsets, *nested_column, src_null_map, *idx_col, nested_null_map, dst_null_map); - } else if (which_type.is_decimal128i()) { - res = _execute_number(offsets, *nested_column, src_null_map, - *idx_col, nested_null_map, dst_null_map); - } else if (which_type.is_decimal128()) { - res = _execute_number(offsets, *nested_column, src_null_map, *idx_col, - nested_null_map, dst_null_map); + } else if (which_type.is_decimal128v3()) { + res = _execute_number(offsets, *nested_column, src_null_map, + *idx_col, nested_null_map, dst_null_map); + } else if (which_type.is_decimal128v2()) { + res = _execute_number(offsets, *nested_column, src_null_map, + *idx_col, nested_null_map, dst_null_map); } else if (which_type.is_decimal256()) { res = _execute_number(offsets, *nested_column, src_null_map, *idx_col, nested_null_map, dst_null_map); diff --git a/be/src/vec/functions/array/function_array_enumerate_uniq.cpp b/be/src/vec/functions/array/function_array_enumerate_uniq.cpp index f3bbf3c57a..9eaa71d08a 100644 --- a/be/src/vec/functions/array/function_array_enumerate_uniq.cpp +++ b/be/src/vec/functions/array/function_array_enumerate_uniq.cpp @@ -196,14 +196,14 @@ public: _execute_number(data_columns, *offsets, null_map, dst_values); } else if (which.is_decimal64()) { _execute_number(data_columns, *offsets, null_map, dst_values); - } else if (which.is_decimal128i()) { - _execute_number(data_columns, *offsets, null_map, dst_values); + } else if (which.is_decimal128v3()) { + _execute_number(data_columns, *offsets, null_map, dst_values); } else if (which.is_decimal256()) { _execute_number(data_columns, *offsets, null_map, dst_values); } else if (which.is_date_time_v2()) { _execute_number(data_columns, *offsets, null_map, dst_values); - } else if (which.is_decimal128()) { - _execute_number(data_columns, *offsets, null_map, dst_values); + } else if (which.is_decimal128v2()) { + _execute_number(data_columns, *offsets, null_map, dst_values); } else if (which.is_string()) { _execute_string(data_columns, *offsets, null_map, dst_values); } diff --git a/be/src/vec/functions/array/function_array_index.h b/be/src/vec/functions/array/function_array_index.h index 23f251e68c..d4a8fa3296 100644 --- a/be/src/vec/functions/array/function_array_index.h +++ b/be/src/vec/functions/array/function_array_index.h @@ -349,12 +349,12 @@ private: return_column = _execute_number_expanded( offsets, nested_null_map, *nested_column, *right_column, right_nested_null_map, array_null_map); - } else if (left_which_type.is_decimal128i()) { - return_column = _execute_number_expanded( + } else if (left_which_type.is_decimal128v3()) { + return_column = _execute_number_expanded( offsets, nested_null_map, *nested_column, *right_column, right_nested_null_map, array_null_map); - } else if (left_which_type.is_decimal128()) { - return_column = _execute_number_expanded( + } else if (left_which_type.is_decimal128v2()) { + return_column = _execute_number_expanded( offsets, nested_null_map, *nested_column, *right_column, right_nested_null_map, array_null_map); } else if (left_which_type.is_decimal256()) { diff --git a/be/src/vec/functions/array/function_array_join.h b/be/src/vec/functions/array/function_array_join.h index b982964914..583738e431 100644 --- a/be/src/vec/functions/array/function_array_join.h +++ b/be/src/vec/functions/array/function_array_join.h @@ -247,16 +247,17 @@ private: } else if (which.is_decimal64()) { res = _execute_number(src_column, src_offsets, src_null_map, sep_str, null_replace_str, nested_type, dest_column_ptr); - } else if (which.is_decimal128i()) { - res = _execute_number(src_column, src_offsets, src_null_map, sep_str, - null_replace_str, nested_type, - dest_column_ptr); + } else if (which.is_decimal128v3()) { + res = _execute_number(src_column, src_offsets, src_null_map, + sep_str, null_replace_str, nested_type, + dest_column_ptr); } else if (which.is_decimal256()) { res = _execute_number(src_column, src_offsets, src_null_map, sep_str, null_replace_str, nested_type, dest_column_ptr); - } else if (which.is_decimal128()) { - res = _execute_number(src_column, src_offsets, src_null_map, sep_str, - null_replace_str, nested_type, dest_column_ptr); + } else if (which.is_decimal128v2()) { + res = _execute_number(src_column, src_offsets, src_null_map, + sep_str, null_replace_str, nested_type, + dest_column_ptr); } else if (which.is_string()) { res = _execute_string(src_column, src_offsets, src_null_map, sep_str, null_replace_str, dest_column_ptr); diff --git a/be/src/vec/functions/array/function_array_remove.h b/be/src/vec/functions/array/function_array_remove.h index 5a0ee49369..2645f87320 100644 --- a/be/src/vec/functions/array/function_array_remove.h +++ b/be/src/vec/functions/array/function_array_remove.h @@ -323,12 +323,12 @@ private: } else if (left_which_type.is_decimal64()) { res = _execute_number_expanded(offsets, *nested_column, *right_column, nested_null_map); - } else if (left_which_type.is_decimal128i()) { - res = _execute_number_expanded(offsets, *nested_column, - *right_column, nested_null_map); - } else if (left_which_type.is_decimal128()) { - res = _execute_number_expanded(offsets, *nested_column, - *right_column, nested_null_map); + } else if (left_which_type.is_decimal128v3()) { + res = _execute_number_expanded(offsets, *nested_column, + *right_column, nested_null_map); + } else if (left_which_type.is_decimal128v2()) { + res = _execute_number_expanded(offsets, *nested_column, + *right_column, nested_null_map); } else if (left_which_type.is_decimal256()) { res = _execute_number_expanded(offsets, *nested_column, *right_column, nested_null_map); diff --git a/be/src/vec/functions/array/function_arrays_overlap.h b/be/src/vec/functions/array/function_arrays_overlap.h index fb138d3edb..d1bca0ec02 100644 --- a/be/src/vec/functions/array/function_arrays_overlap.h +++ b/be/src/vec/functions/array/function_arrays_overlap.h @@ -217,14 +217,14 @@ public: ret = _execute_internal(left_exec_data, right_exec_data, dst_null_map_data, dst_nested_col->get_data().data()); - } else if (left_which_type.is_decimal128i()) { - ret = _execute_internal(left_exec_data, right_exec_data, - dst_null_map_data, - dst_nested_col->get_data().data()); - } else if (left_which_type.is_decimal128()) { - ret = _execute_internal(left_exec_data, right_exec_data, - dst_null_map_data, - dst_nested_col->get_data().data()); + } else if (left_which_type.is_decimal128v3()) { + ret = _execute_internal(left_exec_data, right_exec_data, + dst_null_map_data, + dst_nested_col->get_data().data()); + } else if (left_which_type.is_decimal128v2()) { + ret = _execute_internal(left_exec_data, right_exec_data, + dst_null_map_data, + dst_nested_col->get_data().data()); } else if (left_which_type.is_decimal256()) { ret = _execute_internal(left_exec_data, right_exec_data, dst_null_map_data, diff --git a/be/src/vec/functions/function.h b/be/src/vec/functions/function.h index 44a629bf24..1b4c9fe128 100644 --- a/be/src/vec/functions/function.h +++ b/be/src/vec/functions/function.h @@ -689,11 +689,11 @@ ColumnPtr wrap_in_nullable(const ColumnPtr& src, const Block& block, const Colum M(Float32, ColumnFloat32) \ M(Float64, ColumnFloat64) -#define DECIMAL_TYPE_TO_COLUMN_TYPE(M) \ - M(Decimal32, ColumnDecimal) \ - M(Decimal64, ColumnDecimal) \ - M(Decimal128, ColumnDecimal) \ - M(Decimal128I, ColumnDecimal) \ +#define DECIMAL_TYPE_TO_COLUMN_TYPE(M) \ + M(Decimal32, ColumnDecimal) \ + M(Decimal64, ColumnDecimal) \ + M(Decimal128V2, ColumnDecimal) \ + M(Decimal128V3, ColumnDecimal) \ M(Decimal256, ColumnDecimal) #define STRING_TYPE_TO_COLUMN_TYPE(M) \ diff --git a/be/src/vec/functions/function_binary_arithmetic.h b/be/src/vec/functions/function_binary_arithmetic.h index 4b69561b14..8c433783c2 100644 --- a/be/src/vec/functions/function_binary_arithmetic.h +++ b/be/src/vec/functions/function_binary_arithmetic.h @@ -83,7 +83,7 @@ struct OperationTraits { std::is_same_v>; static constexpr bool can_overflow = (is_plus_minus || is_multiply) && - (IsDecimalV2 || IsDecimalV2 || IsDecimal128I || IsDecimal128I || + (IsDecimalV2 || IsDecimalV2 || IsDecimal128V3 || IsDecimal128V3 || IsDecimal256 || IsDecimal256); static constexpr bool has_variadic_argument = !std::is_void_v()))>; @@ -658,13 +658,13 @@ template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> -inline constexpr bool UseLeftDecimal, DataTypeDecimal> = +inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> -inline constexpr bool UseLeftDecimal, DataTypeDecimal> = +inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> -inline constexpr bool UseLeftDecimal, DataTypeDecimal> = +inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; template <> inline constexpr bool UseLeftDecimal, DataTypeDecimal> = true; @@ -863,7 +863,7 @@ class FunctionBinaryArithmetic : public IFunction { return cast_type_to_either, DataTypeDecimal, - DataTypeDecimal, DataTypeDecimal, + DataTypeDecimal, DataTypeDecimal, DataTypeDecimal>(type, std::forward(f)); } diff --git a/be/src/vec/functions/function_cast.h b/be/src/vec/functions/function_cast.h index 474851e80d..57678b02b6 100644 --- a/be/src/vec/functions/function_cast.h +++ b/be/src/vec/functions/function_cast.h @@ -929,8 +929,8 @@ struct NameToDecimal64 { struct NameToDecimal128 { static constexpr auto name = "toDecimal128"; }; -struct NameToDecimal128I { - static constexpr auto name = "toDecimal128I"; +struct NameToDecimal128V3 { + static constexpr auto name = "toDecimal128V3"; }; struct NameToDecimal256 { static constexpr auto name = "toDecimal256"; @@ -1057,7 +1057,7 @@ StringParser::ParseResult try_parse_decimal_impl(typename DataType::FieldType& x return try_read_decimal_text(x, rb, precision, scale); } - if constexpr (IsDataTypeDecimal128I) { + if constexpr (IsDataTypeDecimal128V3) { UInt32 scale = ((PrecisionScaleArg)additions).scale; UInt32 precision = ((PrecisionScaleArg)additions).precision; return try_read_decimal_text(x, rb, precision, scale); @@ -1333,9 +1333,9 @@ using FunctionToDecimal32 = using FunctionToDecimal64 = FunctionConvert, NameToDecimal64, UnknownMonotonicity>; using FunctionToDecimal128 = - FunctionConvert, NameToDecimal128, UnknownMonotonicity>; -using FunctionToDecimal128I = - FunctionConvert, NameToDecimal128I, UnknownMonotonicity>; + FunctionConvert, NameToDecimal128, UnknownMonotonicity>; +using FunctionToDecimal128V3 = + FunctionConvert, NameToDecimal128V3, UnknownMonotonicity>; using FunctionToDecimal256 = FunctionConvert, NameToDecimal256, UnknownMonotonicity>; using FunctionToIPv4 = FunctionConvert; @@ -1402,12 +1402,12 @@ struct FunctionTo> { using Type = FunctionToDecimal64; }; template <> -struct FunctionTo> { +struct FunctionTo> { using Type = FunctionToDecimal128; }; template <> -struct FunctionTo> { - using Type = FunctionToDecimal128I; +struct FunctionTo> { + using Type = FunctionToDecimal128V3; }; template <> struct FunctionTo> { @@ -1573,11 +1573,11 @@ template struct ConvertImpl, Name> : ConvertThroughParsing, Name> {}; template -struct ConvertImpl, Name> - : ConvertThroughParsing, Name> {}; +struct ConvertImpl, Name> + : ConvertThroughParsing, Name> {}; template -struct ConvertImpl, Name> - : ConvertThroughParsing, Name> {}; +struct ConvertImpl, Name> + : ConvertThroughParsing, Name> {}; template struct ConvertImpl, Name> : ConvertThroughParsing, Name> {}; @@ -2414,8 +2414,8 @@ private: if constexpr (std::is_same_v> || std::is_same_v> || - std::is_same_v> || - std::is_same_v> || + std::is_same_v> || + std::is_same_v> || std::is_same_v>) { ret = create_decimal_wrapper(from_type, check_and_get_data_type(to_type.get())); diff --git a/be/src/vec/functions/function_string.h b/be/src/vec/functions/function_string.h index 3d8e522039..2b1d5891a6 100644 --- a/be/src/vec/functions/function_string.h +++ b/be/src/vec/functions/function_string.h @@ -2411,12 +2411,12 @@ struct MoneyFormatInt128Impl { struct MoneyFormatDecimalImpl { static DataTypes get_variadic_argument_types() { - return {std::make_shared>(27, 9)}; + return {std::make_shared>(27, 9)}; } static void execute(FunctionContext* context, ColumnString* result_column, ColumnPtr col_ptr, size_t input_rows_count) { - if (auto* decimalv2_column = check_and_get_column>(*col_ptr)) { + if (auto* decimalv2_column = check_and_get_column>(*col_ptr)) { for (size_t i = 0; i < input_rows_count; i++) { DecimalV2Value value = DecimalV2Value(decimalv2_column->get_element(i)); @@ -2467,12 +2467,12 @@ struct MoneyFormatDecimalImpl { result_column->insert_data(str.data, str.size); } } else if (auto* decimal128_column = - check_and_get_column>(*col_ptr)) { + check_and_get_column>(*col_ptr)) { const UInt32 scale = decimal128_column->get_scale(); const auto multiplier = scale > 2 ? common::exp10_i32(scale - 2) : common::exp10_i32(2 - scale); for (size_t i = 0; i < input_rows_count; i++) { - Decimal128I frac_part = decimal128_column->get_fractional_part(i); + Decimal128V3 frac_part = decimal128_column->get_fractional_part(i); if (scale > 2) { int delta = ((frac_part % multiplier) << 1) > multiplier; frac_part = frac_part / multiplier + delta; diff --git a/be/src/vec/functions/function_unary_arithmetic.h b/be/src/vec/functions/function_unary_arithmetic.h index 8d18129a04..723fccad97 100644 --- a/be/src/vec/functions/function_unary_arithmetic.h +++ b/be/src/vec/functions/function_unary_arithmetic.h @@ -72,7 +72,7 @@ class FunctionUnaryArithmetic : public IFunction { DataTypeInt8, DataTypeInt16, DataTypeInt32, DataTypeInt64, DataTypeInt128, DataTypeFloat32, DataTypeFloat64, DataTypeDecimal, DataTypeDecimal, - DataTypeDecimal, DataTypeDecimal, + DataTypeDecimal, DataTypeDecimal, DataTypeDecimal>(type, std::forward(f)); } diff --git a/be/src/vec/functions/function_width_bucket.cpp b/be/src/vec/functions/function_width_bucket.cpp index 40c08a950e..193cf832b1 100644 --- a/be/src/vec/functions/function_width_bucket.cpp +++ b/be/src/vec/functions/function_width_bucket.cpp @@ -136,18 +136,18 @@ private: } else if (which.is_float64()) { _execute(expr_column, min_value_column, max_value_column, num_buckets, nested_column_column); - } else if (which.is_decimal128()) { - _execute(expr_column, min_value_column, max_value_column, num_buckets, - nested_column_column); + } else if (which.is_decimal128v2()) { + _execute(expr_column, min_value_column, max_value_column, + num_buckets, nested_column_column); } else if (which.is_decimal32()) { _execute(expr_column, min_value_column, max_value_column, num_buckets, nested_column_column); } else if (which.is_decimal64()) { _execute(expr_column, min_value_column, max_value_column, num_buckets, nested_column_column); - } else if (which.is_decimal128i()) { - _execute(expr_column, min_value_column, max_value_column, - num_buckets, nested_column_column); + } else if (which.is_decimal128v3()) { + _execute(expr_column, min_value_column, max_value_column, + num_buckets, nested_column_column); } else if (which.is_decimal256()) { _execute(expr_column, min_value_column, max_value_column, num_buckets, nested_column_column); diff --git a/be/src/vec/functions/least_greast.cpp b/be/src/vec/functions/least_greast.cpp index 4c008da67f..9d8cd318b4 100644 --- a/be/src/vec/functions/least_greast.cpp +++ b/be/src/vec/functions/least_greast.cpp @@ -128,7 +128,7 @@ private: auto* __restrict column_raw_data = reinterpret_cast(argument_column.get())->get_data().data(); - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { for (size_t i = 0; i < input_rows_count; ++i) { result_raw_data[i] = Op::apply( @@ -138,7 +138,7 @@ private: } } else if constexpr (std::is_same_v || std::is_same_v || - std::is_same_v || + std::is_same_v || std::is_same_v) { for (size_t i = 0; i < input_rows_count; ++i) { using type = std::decay_t; @@ -237,7 +237,7 @@ private: auto [argument_column_raw, argument_column_is_const] = unpack_if_const(argument_column); const auto& arg_data = assert_cast(*argument_column_raw).get_data().data()[0]; - if constexpr (std::is_same_v) { + if constexpr (std::is_same_v) { for (size_t i = 0; i < input_rows_count; ++i) { res_data[i] |= (!res_data[i] * (EqualsOp::apply( @@ -246,7 +246,7 @@ private: } } else if constexpr (std::is_same_v || std::is_same_v || - std::is_same_v || + std::is_same_v || std::is_same_v) { for (size_t i = 0; i < input_rows_count; ++i) { using type = std::decay_t; diff --git a/be/src/vec/functions/multiply.cpp b/be/src/vec/functions/multiply.cpp index 0dc9f4a410..43da8bb56f 100644 --- a/be/src/vec/functions/multiply.cpp +++ b/be/src/vec/functions/multiply.cpp @@ -53,9 +53,9 @@ struct MultiplyImpl { 999999999999999999999999998000000000.000000000000000001 54 digits */ template - static void vector_vector(const ColumnDecimal128::Container::value_type* __restrict a, - const ColumnDecimal128::Container::value_type* __restrict b, - ColumnDecimal128::Container::value_type* c, size_t size) { + static void vector_vector(const ColumnDecimal128V2::Container::value_type* __restrict a, + const ColumnDecimal128V2::Container::value_type* __restrict b, + ColumnDecimal128V2::Container::value_type* c, size_t size) { auto sng_uptr = std::unique_ptr(new int8[size]); int8* sgn = sng_uptr.get(); auto max = DecimalV2Value::get_max_decimal(); diff --git a/be/src/vec/io/io_helper.h b/be/src/vec/io/io_helper.h index c9e52fe87a..b3c475c947 100644 --- a/be/src/vec/io/io_helper.h +++ b/be/src/vec/io/io_helper.h @@ -389,7 +389,7 @@ template StringParser::ParseResult read_decimal_text_impl(T& x, ReadBuffer& buf, UInt32 precision, UInt32 scale) { static_assert(IsDecimalNumber); - if constexpr (!std::is_same_v) { + if constexpr (!std::is_same_v) { StringParser::ParseResult result = StringParser::PARSE_SUCCESS; x.value = StringParser::string_to_decimal

((const char*)buf.position(), buf.count(), diff --git a/be/src/vec/olap/olap_data_convertor.cpp b/be/src/vec/olap/olap_data_convertor.cpp index 2820cca53c..d2f1d431da 100644 --- a/be/src/vec/olap/olap_data_convertor.cpp +++ b/be/src/vec/olap/olap_data_convertor.cpp @@ -131,7 +131,7 @@ OlapBlockDataConvertor::create_olap_column_data_convertor(const TabletColumn& co return std::make_unique>(); } case FieldType::OLAP_FIELD_TYPE_DECIMAL128I: { - return std::make_unique>(); + return std::make_unique>(); } case FieldType::OLAP_FIELD_TYPE_DECIMAL256: { return std::make_unique>(); @@ -838,14 +838,14 @@ Status OlapBlockDataConvertor::OlapColumnDataConvertorDateTime::convert_to_olap( Status OlapBlockDataConvertor::OlapColumnDataConvertorDecimal::convert_to_olap() { assert(_typed_column.column); - const vectorized::ColumnDecimal* column_decimal = nullptr; + const vectorized::ColumnDecimal* column_decimal = nullptr; if (_nullmap) { auto nullable_column = assert_cast(_typed_column.column.get()); - column_decimal = assert_cast*>( + column_decimal = assert_cast*>( nullable_column->get_nested_column_ptr().get()); } else { - column_decimal = assert_cast*>( + column_decimal = assert_cast*>( _typed_column.column.get()); } diff --git a/be/src/vec/sink/vmysql_result_writer.cpp b/be/src/vec/sink/vmysql_result_writer.cpp index 336f627fcc..6a7e16a484 100644 --- a/be/src/vec/sink/vmysql_result_writer.cpp +++ b/be/src/vec/sink/vmysql_result_writer.cpp @@ -152,12 +152,12 @@ Status VMysqlResultWriter::append_block(Block& input_block) { if (_output_vexpr_ctxs[col_idx]->root()->type().is_decimal_v2_type()) { if (_output_vexpr_ctxs[col_idx]->root()->is_nullable()) { auto nested_serde = - std::make_shared>(scale, - 27); + std::make_shared>(scale, + 27); serde = std::make_shared(nested_serde); } else { - serde = std::make_shared>(scale, - 27); + serde = std::make_shared>(scale, + 27); } } else { serde = block.get_by_position(col_idx).type->get_serde(); diff --git a/be/src/vec/sink/vtablet_block_convertor.cpp b/be/src/vec/sink/vtablet_block_convertor.cpp index 5e2358fc37..ab3060af3a 100644 --- a/be/src/vec/sink/vtablet_block_convertor.cpp +++ b/be/src/vec/sink/vtablet_block_convertor.cpp @@ -137,7 +137,7 @@ DecimalType OlapTableBlockConvertor::_get_decimalv3_min_or_max(const TypeDescrip pmap = IsMin ? &_min_decimal32_val : &_max_decimal32_val; } else if constexpr (std::is_same_v) { pmap = IsMin ? &_min_decimal64_val : &_max_decimal64_val; - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { pmap = IsMin ? &_min_decimal128_val : &_max_decimal128_val; } else { pmap = IsMin ? &_min_decimal256_val : &_max_decimal256_val; @@ -256,8 +256,8 @@ Status OlapTableBlockConvertor::_validate_column(RuntimeState* state, const Type break; } case TYPE_DECIMALV2: { - auto* column_decimal = const_cast*>( - assert_cast*>( + auto* column_decimal = const_cast*>( + assert_cast*>( real_column_ptr.get())); const auto& max_decimalv2 = _get_decimalv2_min_or_max(type); const auto& min_decimalv2 = _get_decimalv2_min_or_max(type); @@ -335,7 +335,7 @@ Status OlapTableBlockConvertor::_validate_column(RuntimeState* state, const Type break; } case TYPE_DECIMAL128I: { - CHECK_VALIDATION_FOR_DECIMALV3(vectorized::Decimal128I); + CHECK_VALIDATION_FOR_DECIMALV3(vectorized::Decimal128V3); break; } case TYPE_DECIMAL256: { diff --git a/be/src/vec/sink/writer/vmysql_table_writer.cpp b/be/src/vec/sink/writer/vmysql_table_writer.cpp index fdcedf5996..4a3513c80f 100644 --- a/be/src/vec/sink/writer/vmysql_table_writer.cpp +++ b/be/src/vec/sink/writer/vmysql_table_writer.cpp @@ -196,7 +196,7 @@ Status VMysqlTableWriter::_insert_row(vectorized::Block& block, size_t row) { case TYPE_DECIMALV2: { DecimalV2Value value = (DecimalV2Value) - assert_cast&>( + assert_cast&>( *column) .get_data()[row]; fmt::format_to(_insert_stmt_buffer, "{}", value.to_string()); diff --git a/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp b/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp index 619e575f96..189786a0ec 100644 --- a/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp +++ b/be/test/olap/rowset/segment_v2/column_reader_writer_test.cpp @@ -542,7 +542,7 @@ static vectorized::MutableColumnPtr create_vectorized_column_ptr(FieldType type) } else if (type == FieldType::OLAP_FIELD_TYPE_DATETIME) { return vectorized::DataTypeDateTime().create_column(); } else if (type == FieldType::OLAP_FIELD_TYPE_DECIMAL) { - return vectorized::DataTypeDecimal(27, 9).create_column(); + return vectorized::DataTypeDecimal(27, 9).create_column(); } return vectorized::DataTypeNothing().create_column(); } diff --git a/be/test/vec/aggregate_functions/agg_collect_test.cpp b/be/test/vec/aggregate_functions/agg_collect_test.cpp index cb750f1a0c..d592967cbe 100644 --- a/be/test/vec/aggregate_functions/agg_collect_test.cpp +++ b/be/test/vec/aggregate_functions/agg_collect_test.cpp @@ -147,8 +147,8 @@ TEST_F(VAggCollectTest, test_empty) { test_agg_collect("collect_list"); test_agg_collect("collect_set"); - test_agg_collect>("collect_list"); - test_agg_collect>("collect_set"); + test_agg_collect>("collect_list"); + test_agg_collect>("collect_set"); test_agg_collect("collect_list"); test_agg_collect("collect_set"); @@ -163,8 +163,8 @@ TEST_F(VAggCollectTest, test_with_data) { test_agg_collect("collect_list", 20); test_agg_collect("collect_set", 30); - test_agg_collect>("collect_list", 10); - test_agg_collect>("collect_set", 11); + test_agg_collect>("collect_list", 10); + test_agg_collect>("collect_set", 11); test_agg_collect("collect_list", 5); test_agg_collect("collect_set", 6); diff --git a/be/test/vec/aggregate_functions/agg_histogram_test.cpp b/be/test/vec/aggregate_functions/agg_histogram_test.cpp index 7d7037f6c6..069b876295 100644 --- a/be/test/vec/aggregate_functions/agg_histogram_test.cpp +++ b/be/test/vec/aggregate_functions/agg_histogram_test.cpp @@ -218,7 +218,7 @@ TEST_F(VAggHistogramTest, test_empty) { test_agg_histogram(); test_agg_histogram(); test_agg_histogram(); - test_agg_histogram>(); + test_agg_histogram>(); } TEST_F(VAggHistogramTest, test_with_data) { @@ -238,7 +238,7 @@ TEST_F(VAggHistogramTest, test_with_data) { test_agg_histogram(100, 5); test_agg_histogram(100, 5); - test_agg_histogram>(100, 5); + test_agg_histogram>(100, 5); } } // namespace doris::vectorized diff --git a/be/test/vec/aggregate_functions/agg_min_max_test.cpp b/be/test/vec/aggregate_functions/agg_min_max_test.cpp index aaff93d5e6..fef91af4d1 100644 --- a/be/test/vec/aggregate_functions/agg_min_max_test.cpp +++ b/be/test/vec/aggregate_functions/agg_min_max_test.cpp @@ -78,12 +78,12 @@ TEST_P(AggMinMaxTest, min_max_test) { TEST_P(AggMinMaxTest, min_max_decimal_test) { std::string min_max_type = GetParam(); - auto data_type = std::make_shared>(); + auto data_type = std::make_shared>(); // Prepare test data. auto column_vector_decimal128 = data_type->create_column(); for (int i = 0; i < agg_test_batch_size; i++) { column_vector_decimal128->insert( - cast_to_nearest_field_type(DecimalField(Decimal128(i), 9))); + cast_to_nearest_field_type(DecimalField(Decimal128V2(i), 9))); } // Prepare test function and parameters. @@ -102,7 +102,7 @@ TEST_P(AggMinMaxTest, min_max_decimal_test) { } // Check result. - ColumnDecimal128 ans(0, 9); + ColumnDecimal128V2 ans(0, 9); agg_function->insert_result_into(place, ans); EXPECT_EQ(min_max_type == "min" ? 0 : agg_test_batch_size - 1, ans.get_element(0).value); agg_function->destroy(place); @@ -114,7 +114,7 @@ TEST_P(AggMinMaxTest, min_max_decimal_test) { AggregateDataPtr places = memory2.get(); agg_function->deserialize_from_column(places, *dst, nullptr, agg_test_batch_size); - ColumnDecimal128 result(0, 9); + ColumnDecimal128V2 result(0, 9); for (size_t i = 0; i != agg_test_batch_size; ++i) { agg_function->insert_result_into(places + agg_function->size_of_data() * i, result); } diff --git a/be/test/vec/aggregate_functions/agg_replace_test.cpp b/be/test/vec/aggregate_functions/agg_replace_test.cpp index 5bc50b149d..092b7e4fe6 100644 --- a/be/test/vec/aggregate_functions/agg_replace_test.cpp +++ b/be/test/vec/aggregate_functions/agg_replace_test.cpp @@ -364,7 +364,7 @@ TEST_F(VAggReplaceTest, test_basic_data) { test_basic_data(11); test_basic_data(11); test_basic_data(11); - test_basic_data, ColumnDecimal128, false>(11); + test_basic_data, ColumnDecimal128V2, false>(11); test_basic_data(11); test_basic_data(11); test_basic_data(11); @@ -377,7 +377,7 @@ TEST_F(VAggReplaceTest, test_array_data) { test_array_data(11); test_array_data(11); test_array_data(11); - test_array_data, ColumnArray, false>(11); + test_array_data, ColumnArray, false>(11); test_array_data(11); test_array_data(11); test_array_data(11); @@ -390,7 +390,7 @@ TEST_F(VAggReplaceTest, test_basic_replace_reader) { test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); - test_agg_replace, false>("replace_reader", 10, 0); + test_agg_replace, false>("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); @@ -403,7 +403,7 @@ TEST_F(VAggReplaceTest, test_basic_replace_reader) { test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); - test_agg_replace, true>("replace_reader", 10, 0); + test_agg_replace, true>("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); test_agg_replace("replace_reader", 10, 0); @@ -417,7 +417,7 @@ TEST_F(VAggReplaceTest, test_basic_replace_load) { test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); - test_agg_replace, false>("replace_load", 10, 9); + test_agg_replace, false>("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); @@ -429,7 +429,7 @@ TEST_F(VAggReplaceTest, test_basic_replace_load) { test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); - test_agg_replace, true>("replace_load", 10, 9); + test_agg_replace, true>("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); test_agg_replace("replace_load", 10, 9); @@ -443,7 +443,7 @@ TEST_F(VAggReplaceTest, test_array_replace_reader) { test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); - test_agg_array_replace, false>("replace_reader", 10, 0); + test_agg_array_replace, false>("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); @@ -453,7 +453,7 @@ TEST_F(VAggReplaceTest, test_array_replace_reader) { test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); - test_agg_array_replace, true>("replace_reader", 10, 0); + test_agg_array_replace, true>("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); test_agg_array_replace("replace_reader", 10, 0); @@ -465,7 +465,7 @@ TEST_F(VAggReplaceTest, test_array_replace_load) { test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); - test_agg_array_replace, false>("replace_load", 10, 10); + test_agg_array_replace, false>("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); @@ -475,7 +475,7 @@ TEST_F(VAggReplaceTest, test_array_replace_load) { test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); - test_agg_array_replace, true>("replace_load", 10, 10); + test_agg_array_replace, true>("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); test_agg_array_replace("replace_load", 10, 10); diff --git a/be/test/vec/columns/column_hash_func_test.cpp b/be/test/vec/columns/column_hash_func_test.cpp index bdde0f33a6..a95c7071af 100644 --- a/be/test/vec/columns/column_hash_func_test.cpp +++ b/be/test/vec/columns/column_hash_func_test.cpp @@ -42,7 +42,7 @@ DataTypes create_scala_data_types() { DataTypePtr d = std::make_shared(std::make_shared()); DataTypePtr dc = std::make_shared(vectorized::create_decimal(10, 2, false)); DataTypePtr dcv2 = std::make_shared( - std::make_shared>(27, 9)); + std::make_shared>(27, 9)); DataTypePtr n3 = std::make_shared(std::make_shared()); DataTypePtr n1 = std::make_shared(std::make_shared()); DataTypePtr s1 = std::make_shared(std::make_shared()); diff --git a/be/test/vec/columns/column_resize_test.cpp b/be/test/vec/columns/column_resize_test.cpp index 809ceb5c5c..dd6f78f3e8 100644 --- a/be/test/vec/columns/column_resize_test.cpp +++ b/be/test/vec/columns/column_resize_test.cpp @@ -44,7 +44,7 @@ DataTypes _create_scala_data_types() { DataTypePtr d = std::make_shared(std::make_shared()); DataTypePtr dc = std::make_shared(vectorized::create_decimal(10, 2, false)); DataTypePtr dcv2 = std::make_shared( - std::make_shared>(27, 9)); + std::make_shared>(27, 9)); DataTypePtr n3 = std::make_shared(std::make_shared()); DataTypePtr n1 = std::make_shared(std::make_shared()); DataTypePtr s1 = std::make_shared(std::make_shared()); diff --git a/be/test/vec/exprs/vexpr_test.cpp b/be/test/vec/exprs/vexpr_test.cpp index 81396c9e95..94cec355cf 100644 --- a/be/test/vec/exprs/vexpr_test.cpp +++ b/be/test/vec/exprs/vexpr_test.cpp @@ -557,7 +557,7 @@ TEST(TEST_VEXPR, LITERALTEST) { int ret = -1; static_cast(literal.execute(nullptr, &block, &ret)); auto ctn = block.safe_get_by_position(ret); - auto v = (*ctn.column)[0].get>(); + auto v = (*ctn.column)[0].get>(); EXPECT_FLOAT_EQ(((double)v.get_value()) / (std::pow(10, v.get_scale())), 1234.56); EXPECT_EQ("1234.560000000", literal.value()); } diff --git a/be/test/vec/function/function_array_element_test.cpp b/be/test/vec/function/function_array_element_test.cpp index 1b4a55ea38..2d89164f55 100644 --- a/be/test/vec/function/function_array_element_test.cpp +++ b/be/test/vec/function/function_array_element_test.cpp @@ -130,9 +130,9 @@ TEST(function_array_element_test, element_at) { static_cast(check_function(func_name, input_types, data_set)); } - // element_at(Array, Int64) + // element_at(Array, Int64) { - InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128, TypeIndex::Int64}; + InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128V2, TypeIndex::Int64}; Array vec = {ut_type::DECIMALFIELD(17014116.67), ut_type::DECIMALFIELD(-17014116.67), ut_type::DECIMALFIELD(0.0)}; @@ -146,8 +146,8 @@ TEST(function_array_element_test, element_at) { {{empty_arr, Int64(0)}, Null()}, {{empty_arr, Int64(1)}, Null()}}; - static_cast(check_function, true>(func_name, input_types, - data_set)); + static_cast(check_function, true>( + func_name, input_types, data_set)); } // element_at(Array, Int32) diff --git a/be/test/vec/function/function_array_index_test.cpp b/be/test/vec/function/function_array_index_test.cpp index 0953f0f6f7..7f496dc1cc 100644 --- a/be/test/vec/function/function_array_index_test.cpp +++ b/be/test/vec/function/function_array_index_test.cpp @@ -140,9 +140,10 @@ TEST(function_array_index_test, array_contains) { static_cast(check_function(func_name, input_types, data_set)); } - // array_contains(Array, Decimal128) + // array_contains(Array, Decimal128V2) { - InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128, TypeIndex::Decimal128}; + InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128V2, + TypeIndex::Decimal128V2}; Array vec = {ut_type::DECIMALFIELD(17014116.67), ut_type::DECIMALFIELD(-17014116.67), ut_type::DECIMALFIELD(0.0)}; @@ -242,9 +243,10 @@ TEST(function_array_index_test, array_position) { static_cast(check_function(func_name, input_types, data_set)); } - // array_position(Array, Decimal128) + // array_position(Array, Decimal128V2) { - InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128, TypeIndex::Decimal128}; + InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128V2, + TypeIndex::Decimal128V2}; Array vec = {ut_type::DECIMALFIELD(17014116.67), ut_type::DECIMALFIELD(-17014116.67), ut_type::DECIMALFIELD(0)}; diff --git a/be/test/vec/function/function_arrays_overlap_test.cpp b/be/test/vec/function/function_arrays_overlap_test.cpp index 6811f6e6e4..4a13d41b0a 100644 --- a/be/test/vec/function/function_arrays_overlap_test.cpp +++ b/be/test/vec/function/function_arrays_overlap_test.cpp @@ -105,10 +105,10 @@ TEST(function_arrays_overlap_test, arrays_overlap) { static_cast(check_function(func_name, input_types, data_set)); } - // arrays_overlap(Array, Array) + // arrays_overlap(Array, Array) { - InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128, TypeIndex::Array, - TypeIndex::Decimal128}; + InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128V2, TypeIndex::Array, + TypeIndex::Decimal128V2}; Array vec1 = {ut_type::DECIMALFIELD(17014116.67), ut_type::DECIMALFIELD(-17014116.67), ut_type::DECIMALFIELD(0.0)}; diff --git a/be/test/vec/function/function_math_test.cpp b/be/test/vec/function/function_math_test.cpp index 4fbee8289b..c93c6ca324 100644 --- a/be/test/vec/function/function_math_test.cpp +++ b/be/test/vec/function/function_math_test.cpp @@ -516,7 +516,7 @@ TEST(MathFunctionTest, money_format_test) { static_cast(check_function(func_name, input_types, data_set)); } { - InputTypeSet input_types = {TypeIndex::Decimal128}; + InputTypeSet input_types = {TypeIndex::Decimal128V2}; DataSet data_set = {{{Null()}, Null()}, {{DECIMAL(17014116.67)}, VARCHAR("17,014,116.67")}, {{DECIMAL(-17014116.67)}, VARCHAR("-17,014,116.67")}}; diff --git a/be/test/vec/function/function_test_util.cpp b/be/test/vec/function/function_test_util.cpp index 4ae7907921..50d1d3ab09 100644 --- a/be/test/vec/function/function_test_util.cpp +++ b/be/test/vec/function/function_test_util.cpp @@ -130,9 +130,9 @@ size_t type_index_to_data_type(const std::vector& input_types, size_t i desc.type = doris::PrimitiveType::TYPE_DOUBLE; type = std::make_shared(); return 1; - case TypeIndex::Decimal128: + case TypeIndex::Decimal128V2: desc.type = doris::PrimitiveType::TYPE_DECIMALV2; - type = std::make_shared>(); + type = std::make_shared>(); return 1; case TypeIndex::DateTime: desc.type = doris::PrimitiveType::TYPE_DATETIME; @@ -266,7 +266,7 @@ bool insert_cell(MutableColumnPtr& column, DataTypePtr type_ptr, const AnyType& } else if (type.is_float64()) { auto value = any_cast(cell); column->insert_data(reinterpret_cast(&value), 0); - } else if (type.is_decimal128()) { + } else if (type.is_decimal128v2()) { auto value = any_cast>(cell); column->insert_data(reinterpret_cast(&value), 0); } else if (type.is_date_time()) { diff --git a/be/test/vec/function/function_test_util.h b/be/test/vec/function/function_test_util.h index 62e4f6fd00..f488690f51 100644 --- a/be/test/vec/function/function_test_util.h +++ b/be/test/vec/function/function_test_util.h @@ -102,9 +102,9 @@ using STRING = std::string; using DOUBLE = double; using FLOAT = float; -inline auto DECIMAL = Decimal128::double_to_decimal; +inline auto DECIMAL = Decimal128V2::double_to_decimal; inline auto DECIMALFIELD = [](double v) { - return DecimalField(Decimal128::double_to_decimal(v), 9); + return DecimalField(Decimal128V2::double_to_decimal(v), 9); }; using DATETIME = std::string; @@ -315,8 +315,8 @@ Status check_function(const std::string& func_name, const InputTypeSet& input_ty const auto& expect_data = any_cast(data_set[i].second); - if constexpr (std::is_same_v>) { - const auto& column_data = field.get>().get_value(); + if constexpr (std::is_same_v>) { + const auto& column_data = field.get>().get_value(); EXPECT_EQ(expect_data.value, column_data.value) << " at row " << i; } else if constexpr (std::is_same_v) { const ColumnBitmap* bitmap_col = nullptr; diff --git a/be/test/vec/function/table_function_test.cpp b/be/test/vec/function/table_function_test.cpp index 0faaa1515c..95983e4d31 100644 --- a/be/test/vec/function/table_function_test.cpp +++ b/be/test/vec/function/table_function_test.cpp @@ -111,11 +111,11 @@ TEST_F(TableFunctionTest, vexplode_outer) { // explode_outer(Array) { - InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128}; + InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Decimal128V2}; Array vec = {ut_type::DECIMALFIELD(17014116.67), ut_type::DECIMALFIELD(-17014116.67)}; InputDataSet input_set = {{Null()}, {Array()}, {vec}}; - InputTypeSet output_types = {TypeIndex::Decimal128}; + InputTypeSet output_types = {TypeIndex::Decimal128V2}; InputDataSet output_set = {{Null()}, {Null()}, {ut_type::DECIMAL(17014116.67)}, diff --git a/be/test/vec/utils/arrow_column_to_doris_column_test.cpp b/be/test/vec/utils/arrow_column_to_doris_column_test.cpp index 58ae47f75b..152941c5a9 100644 --- a/be/test/vec/utils/arrow_column_to_doris_column_test.cpp +++ b/be/test/vec/utils/arrow_column_to_doris_column_test.cpp @@ -383,7 +383,7 @@ void test_arrow_to_decimal_column(std::shared_ptr type, data_column = (*std::move(column.column)).mutate(); } auto& decimal_data = - static_cast&>(*data_column).get_data(); + static_cast&>(*data_column).get_data(); for (auto i = 0; i < num_elements; ++i) { auto idx = counter - num_elements + i; if (is_nullable) {