Skip to content

Commit

Permalink
simply code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinyhZou committed Jan 9, 2025
1 parent db3a9e2 commit 5881bc4
Showing 1 changed file with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,25 +178,8 @@ class FunctionCheckDecimalOverflow : public IFunction
{
ToFieldType result;
bool success = convertToDecimalImpl<FromDataType, ToDataType>(datas[i], precision, scale_from, scale_to, decimal_int_part_max, decimal_int_part_min, result);

if constexpr (IsDataTypeNumber<FromDataType>)
{
vec_to[i] = static_cast<ToFieldType>(result);
(*vec_null_map_to)[i] = !success;
}
else
{
if (success)
vec_to[i] = static_cast<ToFieldType>(result);
else
{
vec_to[i] = static_cast<ToFieldType>(0);
if constexpr (exception_mode == CheckExceptionMode::Null)
(*vec_null_map_to)[i] = static_cast<UInt8>(1);
else
throw Exception(ErrorCodes::DECIMAL_OVERFLOW, "Decimal value is overflow.");
}
}
vec_to[i] = static_cast<ToFieldType>(result);
(*vec_null_map_to)[i] = !success;
}

if constexpr (exception_mode == CheckExceptionMode::Null)
Expand Down

0 comments on commit 5881bc4

Please sign in to comment.