mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
use tryConvertFieldToType in getHyperrectangleForRowGroup
This commit is contained in:
parent
52dc9a54a7
commit
9ce8bf0b1e
@ -572,6 +572,16 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
|
||||
|
||||
}
|
||||
|
||||
Field tryConvertFieldToType(const Field & from_value, const IDataType & to_type, const IDataType * from_type_hint, const FormatSettings & format_settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
return convertFieldToType(from_value, to_type, from_type_hint, format_settings);
|
||||
} catch (...)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Field convertFieldToType(const Field & from_value, const IDataType & to_type, const IDataType * from_type_hint, const FormatSettings & format_settings)
|
||||
{
|
||||
|
@ -18,6 +18,8 @@ class IDataType;
|
||||
*/
|
||||
Field convertFieldToType(const Field & from_value, const IDataType & to_type, const IDataType * from_type_hint = nullptr, const FormatSettings & format_settings = {});
|
||||
|
||||
Field tryConvertFieldToType(const Field & from_value, const IDataType & to_type, const IDataType * from_type_hint = nullptr, const FormatSettings & format_settings = {});
|
||||
|
||||
/// Does the same, but throws ARGUMENT_OUT_OF_BOUND if value does not fall into the range.
|
||||
Field convertFieldToTypeOrThrow(const Field & from_value, const IDataType & to_type, const IDataType * from_type_hint = nullptr, const FormatSettings & format_settings = {});
|
||||
|
||||
|
@ -344,8 +344,8 @@ static std::vector<Range> getHyperrectangleForRowGroup(const parquet::FileMetaDa
|
||||
/// Allow conversion in some simple cases, otherwise ignore the min/max values.
|
||||
auto min_type = min.getType();
|
||||
auto max_type = max.getType();
|
||||
min = convertFieldToType(min, *type);
|
||||
max = convertFieldToType(max, *type);
|
||||
min = tryConvertFieldToType(min, *type);
|
||||
max = tryConvertFieldToType(max, *type);
|
||||
auto ok_cast = [&](Field::Types::Which from, Field::Types::Which to) -> bool
|
||||
{
|
||||
if (from == to)
|
||||
|
Loading…
Reference in New Issue
Block a user