From d6247338de5ba64f4180ef99dd7e003416ee04d7 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Thu, 31 Mar 2022 13:33:20 +0800 Subject: [PATCH] fix failed stateless tests --- src/Common/NamePrompter.h | 2 +- src/Storages/AlterCommands.cpp | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Common/NamePrompter.h b/src/Common/NamePrompter.h index 9663427ef12..25206cbd25f 100644 --- a/src/Common/NamePrompter.h +++ b/src/Common/NamePrompter.h @@ -110,7 +110,7 @@ public: /// Note: we don't use toString because it will cause writeCString naming conflict in src/Dictionaries/MongoDBDictionarySource.cpp for (auto & hint : hints) 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; diff --git a/src/Storages/AlterCommands.cpp b/src/Storages/AlterCommands.cpp index 44f208adacc..3ddeec4fa47 100644 --- a/src/Storages/AlterCommands.cpp +++ b/src/Storages/AlterCommands.cpp @@ -1046,8 +1046,10 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt if (!all_columns.has(column_name)) { if (!command.if_exists) - throw Exception{"Wrong column name. Cannot find column " + backQuote(column_name) + " to modify", - ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; + throw Exception{ + "Wrong column name. Cannot find column " + backQuote(column_name) + " to modify" + + all_columns.getHintsString(column_name), + ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; else continue; } @@ -1153,7 +1155,8 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt } else if (!command.if_exists) 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); } 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 (!command.if_exists) - throw Exception{"Wrong column name. Cannot find column " + backQuote(command.column_name) + " to comment", - ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; + throw Exception{ + "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) @@ -1196,8 +1201,10 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, ContextPt if (!all_columns.has(command.column_name)) { if (!command.if_exists) - throw Exception{"Wrong column name. Cannot find column " + backQuote(command.column_name) + " to rename", - ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK}; + throw Exception{ + "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 continue; }