mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 18:32:29 +00:00
fix failure tests
This commit is contained in:
parent
0e30bd3b72
commit
99c8d1fd61
@ -10,7 +10,7 @@ namespace DB
|
|||||||
|
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
{
|
{
|
||||||
extern const int BAD_ARGUMENTS;
|
extern const int UNKNOWN_ELEMENT_OF_ENUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -38,7 +38,7 @@ public:
|
|||||||
{
|
{
|
||||||
auto it = value_to_name_map.find(value);
|
auto it = value_to_name_map.find(value);
|
||||||
if (it == value_to_name_map.end())
|
if (it == value_to_name_map.end())
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unexpected value {} in enum", toString(value));
|
throw Exception(ErrorCodes::UNKNOWN_ELEMENT_OF_ENUM, "Unexpected value {} in enum", toString(value));
|
||||||
|
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
@ -660,14 +660,18 @@ static bool decimalEqualsFloat(Field field, Float64 float_value)
|
|||||||
|
|
||||||
std::optional<Field> convertFieldToTypeStrict(const Field & from_value, const IDataType & from_type, const IDataType & to_type, const FormatSettings & format_settings)
|
std::optional<Field> convertFieldToTypeStrict(const Field & from_value, const IDataType & from_type, const IDataType & to_type, const FormatSettings & format_settings)
|
||||||
{
|
{
|
||||||
|
//Field result_value = convertFieldToType(from_value, to_type, &from_type, format_settings);
|
||||||
|
|
||||||
Field result_value;
|
Field result_value;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result_value = convertFieldToType(from_value, to_type, &from_type, format_settings);
|
result_value = convertFieldToType(from_value, to_type, &from_type, format_settings);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (Exception & e)
|
||||||
{
|
{
|
||||||
return {};
|
if (isEnum(from_type) && e.code() == ErrorCodes::UNKNOWN_ELEMENT_OF_ENUM)
|
||||||
|
return {};
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Field::isDecimal(from_value.getType()) && Field::isDecimal(result_value.getType()))
|
if (Field::isDecimal(from_value.getType()) && Field::isDecimal(result_value.getType()))
|
||||||
|
Loading…
Reference in New Issue
Block a user