FunctionHelpers remove areTypesEqual function

This commit is contained in:
Maksim Kita 2023-09-12 17:30:30 +03:00
parent 8d786cab33
commit 310dc22266
5 changed files with 8 additions and 26 deletions

View File

@ -159,12 +159,12 @@ void DictionaryStructure::validateKeyTypes(const DataTypes & key_types) const
const auto & expected_type = key_attributes_types[i];
const auto & actual_type = key_types[i];
if (!areTypesEqual(expected_type, actual_type))
if (!expected_type->equals(*actual_type))
throw Exception(ErrorCodes::TYPE_MISMATCH,
"Key type for complex key at position {} does not match, expected {}, found {}",
i,
expected_type->getName(),
actual_type->getName());
"Key type for complex key at position {} does not match, expected {}, found {}",
i,
expected_type->getName(),
actual_type->getName());
}
}
@ -198,7 +198,7 @@ const DictionaryAttribute & DictionaryStructure::getAttribute(const std::string
{
const auto & attribute = getAttribute(attribute_name);
if (!areTypesEqual(attribute.type, type))
if (!attribute.type->equals(*type))
throw Exception(ErrorCodes::TYPE_MISMATCH,
"Attribute type does not match, expected {}, found {}",
attribute.type->getName(),

View File

@ -218,19 +218,6 @@ checkAndGetNestedArrayOffset(const IColumn ** columns, size_t num_arguments)
return {nested_columns, offsets->data()};
}
bool areTypesEqual(const IDataType & lhs, const IDataType & rhs)
{
const auto & lhs_name = lhs.getName();
const auto & rhs_name = rhs.getName();
return lhs_name == rhs_name;
}
bool areTypesEqual(const DataTypePtr & lhs, const DataTypePtr & rhs)
{
return areTypesEqual(*lhs, *rhs);
}
ColumnPtr wrapInNullable(const ColumnPtr & src, const ColumnsWithTypeAndName & args, const DataTypePtr & result_type, size_t input_rows_count)
{
ColumnPtr result_null_map_column;

View File

@ -155,11 +155,6 @@ void validateFunctionArgumentTypes(const IFunction & func, const ColumnsWithType
std::pair<std::vector<const IColumn *>, const ColumnArray::Offset *>
checkAndGetNestedArrayOffset(const IColumn ** columns, size_t num_arguments);
/// Check if two types are equal
bool areTypesEqual(const IDataType & lhs, const IDataType & rhs);
bool areTypesEqual(const DataTypePtr & lhs, const DataTypePtr & rhs);
/** Return ColumnNullable of src, with null map as OR-ed null maps of args columns.
* Or ColumnConst(ColumnNullable) if the result is always NULL or if the result is constant and always not NULL.
*/

View File

@ -165,7 +165,7 @@ public:
const auto & argument_type = argument.type;
if (areTypesEqual(arguments_copy[i].type, argument_type))
if (arguments_copy[i].type->equals(*argument_type))
continue;
ColumnWithTypeAndName column_to_cast = {column_with_type.column, column_with_type.type, column_with_type.name};

View File

@ -85,7 +85,7 @@ public:
{
auto default_value_type = arguments[2].type;
if (!areTypesEqual(result_type, default_value_type))
if (!result_type->equals(*default_value_type))
{
throw Exception(ErrorCodes::BAD_ARGUMENTS,
"Default value type should be same as cast type. Expected {}. Actual {}",