Merge pull request #65599 from hanfei1991/hanfei/fix_stats_uniq_flaky

fix flaky 02864_statistics_uniq
This commit is contained in:
Han Fei 2024-06-25 21:57:16 +00:00 committed by GitHub
commit 5df88c1a25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View File

@ -1057,7 +1057,7 @@ bool AlterCommand::isRemovingProperty() const
bool AlterCommand::isDropSomething() const
{
return type == Type::DROP_COLUMN || type == Type::DROP_INDEX
return type == Type::DROP_COLUMN || type == Type::DROP_INDEX || type == Type::DROP_STATISTICS
|| type == Type::DROP_CONSTRAINT || type == Type::DROP_PROJECTION;
}

View File

@ -8083,6 +8083,13 @@ void MergeTreeData::checkDropCommandDoesntAffectInProgressMutations(const AlterC
throw_exception(mutation_name, "column", command.column_name);
}
}
else if (command.type == AlterCommand::DROP_STATISTICS)
{
for (const auto & stats_col1 : command.statistics_columns)
for (const auto & stats_col2 : mutation_command.statistics_columns)
if (stats_col1 == stats_col2)
throw_exception(mutation_name, "statistics", stats_col1);
}
}
}
}

View File

@ -1269,6 +1269,7 @@ MergeMutateSelectedEntryPtr StorageMergeTree::selectPartsToMutate(
if (command.type != MutationCommand::Type::DROP_COLUMN
&& command.type != MutationCommand::Type::DROP_INDEX
&& command.type != MutationCommand::Type::DROP_PROJECTION
&& command.type != MutationCommand::Type::DROP_STATISTICS
&& command.type != MutationCommand::Type::RENAME_COLUMN)
{
commands_for_size_validation.push_back(command);

View File

@ -2,6 +2,7 @@ DROP TABLE IF EXISTS t1;
SET allow_experimental_statistics = 1;
SET allow_statistics_optimize = 1;
SET mutations_sync = 1;
CREATE TABLE t1
(