forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASTKillQueryQuery.cpp
43 lines (35 loc) · 1.22 KB
/
ASTKillQueryQuery.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <Parsers/ASTKillQueryQuery.h>
#include <IO/Operators.h>
namespace DB
{
String ASTKillQueryQuery::getID(char delim) const
{
return String("KillQueryQuery") + delim + (where_expression ? where_expression->getID() : "") + delim + String(sync ? "SYNC" : "ASYNC");
}
void ASTKillQueryQuery::formatQueryImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << "KILL ";
switch (type)
{
case Type::Query:
settings.ostr << "QUERY";
break;
case Type::Mutation:
settings.ostr << "MUTATION";
break;
case Type::PartMoveToShard:
settings.ostr << "PART_MOVE_TO_SHARD";
break;
case Type::Transaction:
settings.ostr << "TRANSACTION";
break;
}
formatOnCluster(settings);
if (where_expression)
{
settings.ostr << " WHERE " << (settings.hilite ? hilite_none : "");
where_expression->formatImpl(settings, state, frame);
}
settings.ostr << " " << (settings.hilite ? hilite_keyword : "") << (test ? "TEST" : (sync ? "SYNC" : "ASYNC")) << (settings.hilite ? hilite_none : "");
}
}