fix failed stateless tests

This commit is contained in:
taiyang-li 2022-03-31 13:33:20 +08:00 committed by Antonio Andelic
parent eda299b48b
commit d6247338de
2 changed files with 15 additions and 8 deletions

View File

@ -110,7 +110,7 @@ public:
/// Note: we don't use toString because it will cause writeCString naming conflict in src/Dictionaries/MongoDBDictionarySource.cpp /// Note: we don't use toString because it will cause writeCString naming conflict in src/Dictionaries/MongoDBDictionarySource.cpp
for (auto & hint : hints) for (auto & hint : hints)
hint = "'" + hint + "'"; hint = "'" + hint + "'";
return !hints.empty() ? ", may be you meant: " + boost::algorithm::join(hints, ",") : ""; return !hints.empty() ? ", may be you meant: [" + boost::algorithm::join(hints, ",") + "]" : "";
} }
IHints() = default; IHints() = default;

View File

@ -1046,8 +1046,10 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt
if (!all_columns.has(column_name)) if (!all_columns.has(column_name))
{ {
if (!command.if_exists) if (!command.if_exists)
throw Exception{"Wrong column name. Cannot find column " + backQuote(column_name) + " to modify", throw Exception{
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; "Wrong column name. Cannot find column " + backQuote(column_name) + " to modify"
+ all_columns.getHintsString(column_name),
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK};
else else
continue; continue;
} }
@ -1153,7 +1155,8 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt
} }
else if (!command.if_exists) else if (!command.if_exists)
throw Exception( throw Exception(
"Wrong column name. Cannot find column " + backQuote(command.column_name) + " to drop", "Wrong column name. Cannot find column " + backQuote(command.column_name) + " to drop"
+ all_columns.getHintsString(command.column_name),
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK); ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK);
} }
else if (command.type == AlterCommand::COMMENT_COLUMN) else if (command.type == AlterCommand::COMMENT_COLUMN)
@ -1161,8 +1164,10 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt
if (!all_columns.has(command.column_name)) if (!all_columns.has(command.column_name))
{ {
if (!command.if_exists) if (!command.if_exists)
throw Exception{"Wrong column name. Cannot find column " + backQuote(command.column_name) + " to comment", throw Exception{
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; "Wrong column name. Cannot find column " + backQuote(command.column_name) + " to comment"
+ all_columns.getHintsString(command.column_name),
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK};
} }
} }
else if (command.type == AlterCommand::MODIFY_SETTING || command.type == AlterCommand::RESET_SETTING) else if (command.type == AlterCommand::MODIFY_SETTING || command.type == AlterCommand::RESET_SETTING)
@ -1196,8 +1201,10 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt
if (!all_columns.has(command.column_name)) if (!all_columns.has(command.column_name))
{ {
if (!command.if_exists) if (!command.if_exists)
throw Exception{"Wrong column name. Cannot find column " + backQuote(command.column_name) + " to rename", throw Exception{
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; "Wrong column name. Cannot find column " + backQuote(command.column_name) + " to rename"
+ all_columns.getHintsString(command.column_name),
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK};
else else
continue; continue;
} }