diff --git a/be/src/vec/data_types/data_type_decimal.cpp b/be/src/vec/data_types/data_type_decimal.cpp index 97a211c95e..0a1d9f5b5b 100644 --- a/be/src/vec/data_types/data_type_decimal.cpp +++ b/be/src/vec/data_types/data_type_decimal.cpp @@ -37,8 +37,9 @@ std::string DataTypeDecimal::do_get_name() const { template bool DataTypeDecimal::equals(const IDataType& rhs) const { - if (auto* ptype = typeid_cast*>(&rhs)) + if (auto* ptype = typeid_cast*>(&rhs)) { return scale == ptype->get_scale(); + } return false; } @@ -154,7 +155,7 @@ T DataTypeDecimal::parse_from_string(const std::string& str) const { T value = StringParser::string_to_decimal<__int128>(str.c_str(), str.size(), precision, scale, &result); if (result != StringParser::PARSE_SUCCESS) { - LOG(FATAL) << "Failed to parse string of decimal"; + LOG(WARNING) << "Failed to parse string of decimal"; } return value; } @@ -169,10 +170,11 @@ DataTypePtr create_decimal(UInt64 precision_value, UInt64 scale_value) { LOG(FATAL) << "Negative scales and scales larger than precision are not supported"; } - if (precision_value <= max_decimal_precision()) + if (precision_value <= max_decimal_precision()) { return std::make_shared>(precision_value, scale_value); - else if (precision_value <= max_decimal_precision()) + } else if (precision_value <= max_decimal_precision()) { return std::make_shared>(precision_value, scale_value); + } return std::make_shared>(precision_value, scale_value); } @@ -210,7 +212,7 @@ void convert_to_decimal(T* from_value, T* to_value, int32_t from_scale, int32_t static_cast(DataTypeDecimal>::get_scale_multiplier( to_scale - from_scale)), *to_value)) { - LOG(FATAL) << "Decimal convert overflow"; + LOG(WARNING) << "Decimal convert overflow"; } } } diff --git a/be/src/vec/data_types/data_type_decimal.h b/be/src/vec/data_types/data_type_decimal.h index ec740db242..bb3d739da4 100644 --- a/be/src/vec/data_types/data_type_decimal.h +++ b/be/src/vec/data_types/data_type_decimal.h @@ -376,19 +376,21 @@ convert_to_decimal(const typename FromDataType::FieldType& value, UInt32 scale) if constexpr (std::is_floating_point_v) { if (!std::isfinite(value)) { - LOG(FATAL) << "Decimal convert overflow. Cannot convert infinity or NaN to decimal"; + LOG(WARNING) << "Decimal convert overflow. Cannot convert infinity or NaN to decimal"; } auto out = value * ToDataType::get_scale_multiplier(scale); if (out <= static_cast(std::numeric_limits::min()) || out >= static_cast(std::numeric_limits::max())) { - LOG(FATAL) << "Decimal convert overflow. Float is out of Decimal range"; + LOG(WARNING) << "Decimal convert overflow. Float is out of Decimal range"; } return out; } else { - if constexpr (std::is_same_v) - if (value > static_cast(std::numeric_limits::max())) + if constexpr (std::is_same_v) { + if (value > static_cast(std::numeric_limits::max())) { return convert_decimals, ToDataType>(value, 0, scale); + } + } return convert_decimals, ToDataType>(value, 0, scale); } }