Let the command SYSTEM RELOAD DICTIONARY to use ON CLUSTER syntax

This commit is contained in:
Guillaume Tassery 2019-12-19 08:54:43 +01:00
parent d5b4b40b4e
commit 9e808e4a0d
3 changed files with 11 additions and 3 deletions

View File

@ -12,6 +12,7 @@
#include <Interpreters/InterpreterDropQuery.h>
#include <Interpreters/InterpreterCreateQuery.h>
#include <Interpreters/QueryLog.h>
#include <Interpreters/DDLWorker.h>
#include <Interpreters/PartLog.h>
#include <Interpreters/QueryThreadLog.h>
#include <Interpreters/TraceLog.h>
@ -130,6 +131,9 @@ BlockIO InterpreterSystemQuery::execute()
{
auto & query = query_ptr->as<ASTSystemQuery &>();
if (!query.cluster.empty())
return executeDDLQueryOnCluster(query_ptr, context, {query.database});
using Type = ASTSystemQuery::Type;
/// Use global context with fresh system profile settings

View File

@ -108,8 +108,7 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState &,
};
if (!cluster.empty())
{
}
formatOnCluster(settings);
if ( type == Type::STOP_MERGES
|| type == Type::START_MERGES
|| type == Type::STOP_TTL_MERGES
@ -133,7 +132,9 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState &,
print_database_table();
}
else if (type == Type::RELOAD_DICTIONARY)
{
settings.ostr << " " << backQuoteIfNeed(target_dictionary);
}
}

View File

@ -38,14 +38,17 @@ bool ParserSystemQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected &
if (!found)
return false;
String cluster_str;
switch (res->type)
{
case Type::RELOAD_DICTIONARY:
if (ParserKeyword{"ON"}.ignore(pos, expected))
{
if (!ASTQueryWithOnCluster::parse(pos, res->cluster, expected))
if (!ASTQueryWithOnCluster::parse(pos, cluster_str, expected))
return false;
}
res->cluster = cluster_str;
if (!parseIdentifierOrStringLiteral(pos, expected, res->target_dictionary))
return false;
break;