mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Require mutations for DROP COLUMN by root column name for nested columns
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
ca7e4c6eb2
commit
73ddc25e1e
@ -785,7 +785,7 @@ bool AlterCommand::isRequireMutationStage(const StorageInMemoryMetadata & metada
|
||||
|
||||
/// Drop alias is metadata alter, in other case mutation is required.
|
||||
if (type == DROP_COLUMN)
|
||||
return metadata.columns.hasPhysical(column_name);
|
||||
return metadata.columns.hasColumnOrNested(GetColumnsOptions::AllPhysical, column_name);
|
||||
|
||||
if (type != MODIFY_COLUMN || data_type == nullptr)
|
||||
return false;
|
||||
|
@ -603,6 +603,13 @@ bool ColumnsDescription::hasColumnOrSubcolumn(GetColumnsOptions::Kind kind, cons
|
||||
|| hasSubcolumn(column_name);
|
||||
}
|
||||
|
||||
bool ColumnsDescription::hasColumnOrNested(GetColumnsOptions::Kind kind, const String & column_name) const
|
||||
{
|
||||
auto range = getNameRange(columns, column_name);
|
||||
return range.first != range.second &&
|
||||
defaultKindToGetKind(range.first->default_desc.kind) & kind;
|
||||
}
|
||||
|
||||
bool ColumnsDescription::hasDefaults() const
|
||||
{
|
||||
for (const auto & column : columns)
|
||||
|
@ -167,6 +167,7 @@ public:
|
||||
|
||||
bool hasPhysical(const String & column_name) const;
|
||||
bool hasColumnOrSubcolumn(GetColumnsOptions::Kind kind, const String & column_name) const;
|
||||
bool hasColumnOrNested(GetColumnsOptions::Kind kind, const String & column_name) const;
|
||||
|
||||
NameAndTypePair getPhysical(const String & column_name) const;
|
||||
NameAndTypePair getColumnOrSubcolumn(GetColumnsOptions::Kind kind, const String & column_name) const;
|
||||
|
Loading…
Reference in New Issue
Block a user