Synchronize parsers

This commit is contained in:
Alexey Milovidov 2024-02-29 00:08:36 +01:00
parent e1e66dc2b8
commit 1c9bd029ea
3 changed files with 27 additions and 6 deletions

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:
{