mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Using IDataType::equals to compare for type equivalence #1650
This commit is contained in:
parent
a1fe019b5c
commit
b5af4c95bf
@ -28,7 +28,7 @@ struct NameAndTypePair
|
||||
|
||||
bool operator==(const NameAndTypePair & rhs) const
|
||||
{
|
||||
return name == rhs.name && type->getName() == rhs.type->getName();
|
||||
return name == rhs.name && type->equals(*rhs.type);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -325,7 +325,7 @@ void AlterCommands::validate(IStorage * table, const Context & context)
|
||||
const auto & deduced_type = tmp_column.type;
|
||||
|
||||
// column not specified explicitly in the ALTER query may require default_expression modification
|
||||
if (explicit_type->getName() != deduced_type->getName())
|
||||
if (!explicit_type->equals(*deduced_type))
|
||||
{
|
||||
const auto default_it = defaults.find(column_name);
|
||||
|
||||
|
@ -202,7 +202,7 @@ void ITableDeclaration::check(const NamesAndTypesList & columns) const
|
||||
throw Exception("There is no column with name " + column.name + ". There are columns: "
|
||||
+ listOfColumns(available_columns), ErrorCodes::NO_SUCH_COLUMN_IN_TABLE);
|
||||
|
||||
if (column.type->getName() != it->second->getName())
|
||||
if (!column.type->equals(*it->second))
|
||||
throw Exception("Type mismatch for column " + column.name + ". Column has type "
|
||||
+ it->second->getName() + ", got type " + column.type->getName(), ErrorCodes::TYPE_MISMATCH);
|
||||
|
||||
@ -274,7 +274,7 @@ void ITableDeclaration::check(const Block & block, bool need_all) const
|
||||
throw Exception("There is no column with name " + column.name + ". There are columns: "
|
||||
+ listOfColumns(available_columns), ErrorCodes::NO_SUCH_COLUMN_IN_TABLE);
|
||||
|
||||
if (column.type->getName() != it->second->getName())
|
||||
if (!column.type->equals(*it->second))
|
||||
throw Exception("Type mismatch for column " + column.name + ". Column has type "
|
||||
+ it->second->getName() + ", got type " + column.type->getName(), ErrorCodes::TYPE_MISMATCH);
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ void StorageBuffer::writeBlockToDestination(const Block & block, StoragePtr tabl
|
||||
auto dst_col = structure_of_destination_table.getByPosition(i);
|
||||
if (block.has(dst_col.name))
|
||||
{
|
||||
if (block.getByName(dst_col.name).type->getName() != dst_col.type->getName())
|
||||
if (!block.getByName(dst_col.name).type->equals(*dst_col.type))
|
||||
{
|
||||
LOG_ERROR(log, "Destination table " << destination_database << "." << destination_table
|
||||
<< " have different type of column " << dst_col.name << " ("
|
||||
|
Loading…
Reference in New Issue
Block a user