Merge pull request #60522 from ClickHouse/sync-with-private-3

Synchronize parsers
This commit is contained in:
Alexey Milovidov 2024-03-04 01:00:44 +03:00 committed by GitHub
commit de4bd63a7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 7 deletions

View File

@ -1209,7 +1209,12 @@ AccessRightsElements InterpreterSystemQuery::getRequiredAccessForDDLOnCluster()
break;
}
case Type::DROP_DISK_METADATA_CACHE:
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "Not implemented");
case Type::DROP_DISTRIBUTED_CACHE:
case Type::STOP_VIRTUAL_PARTS_UPDATE:
case Type::START_VIRTUAL_PARTS_UPDATE:
{
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "Only available in ClickHouse Cloud, https://clickhouse.cloud/");
}
case Type::RELOAD_DICTIONARY:
case Type::RELOAD_DICTIONARIES:
case Type::RELOAD_EMBEDDED_DICTIONARIES:

View File

@ -172,6 +172,8 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState & s
case Type::START_PULLING_REPLICATION_LOG:
case Type::STOP_CLEANUP:
case Type::START_CLEANUP:
case Type::START_VIRTUAL_PARTS_UPDATE:
case Type::STOP_VIRTUAL_PARTS_UPDATE:
{
if (table)
{
@ -294,6 +296,12 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState & s
}
break;
}
case Type::DROP_DISTRIBUTED_CACHE:
{
if (!distributed_cache_servive_id.empty())
settings.ostr << (settings.hilite ? hilite_none : "") << " " << distributed_cache_servive_id;
break;
}
case Type::UNFREEZE:
{
print_keyword(" WITH NAME ");

View File

@ -30,6 +30,7 @@ public:
DROP_QUERY_CACHE,
DROP_COMPILED_EXPRESSION_CACHE,
DROP_FILESYSTEM_CACHE,
DROP_DISTRIBUTED_CACHE,
DROP_DISK_METADATA_CACHE,
DROP_SCHEMA_CACHE,
DROP_FORMAT_SCHEMA_CACHE,
@ -98,6 +99,8 @@ public:
STOP_VIEWS,
CANCEL_VIEW,
TEST_VIEW,
STOP_VIRTUAL_PARTS_UPDATE,
START_VIRTUAL_PARTS_UPDATE,
END
};
@ -126,6 +129,8 @@ public:
UInt64 seconds{};
String filesystem_cache_name;
String distributed_cache_servive_id;
std::string key_to_drop;
std::optional<size_t> offset_to_drop;

View File

@ -14,11 +14,6 @@
namespace DB
{
namespace ErrorCodes
{
extern const int SUPPORT_IS_DISABLED;
}
[[nodiscard]] static bool parseQueryWithOnClusterAndMaybeTable(std::shared_ptr<ASTSystemQuery> & res, IParser::Pos & pos,
Expected & expected, bool require_table, bool allow_string_literal)
{
@ -397,6 +392,8 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
case Type::START_PULLING_REPLICATION_LOG:
case Type::STOP_CLEANUP:
case Type::START_CLEANUP:
case Type::STOP_VIRTUAL_PARTS_UPDATE:
case Type::START_VIRTUAL_PARTS_UPDATE:
if (!parseQueryWithOnCluster(res, pos, expected))
return false;
parseDatabaseAndTableAsAST(pos, expected, res->database, res->table);
@ -470,6 +467,15 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
return false;
break;
}
case Type::DROP_DISTRIBUTED_CACHE:
{
ParserLiteral parser;
ASTPtr ast;
if (!parser.parse(pos, ast, expected))
return false;
res->distributed_cache_servive_id = ast->as<ASTLiteral>()->value.safeGet<String>();
break;
}
case Type::SYNC_FILESYSTEM_CACHE:
{
ParserLiteral path_parser;
@ -482,7 +488,9 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
}
case Type::DROP_DISK_METADATA_CACHE:
{
throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, "Not implemented");
if (!parseQueryWithOnClusterAndTarget(res, pos, expected, SystemQueryTargetType::Disk))
return false;
break;
}
case Type::DROP_SCHEMA_CACHE:
{