1 | #pragma once |
2 | |
3 | #include "config_core.h" |
4 | #include <Parsers/ASTQueryWithOnCluster.h> |
5 | #include <Parsers/IAST.h> |
6 | |
7 | |
8 | namespace DB |
9 | { |
10 | |
11 | class ASTSystemQuery : public IAST, public ASTQueryWithOnCluster |
12 | { |
13 | public: |
14 | |
15 | enum class Type |
16 | { |
17 | UNKNOWN, |
18 | SHUTDOWN, |
19 | KILL, |
20 | DROP_DNS_CACHE, |
21 | DROP_MARK_CACHE, |
22 | DROP_UNCOMPRESSED_CACHE, |
23 | #if USE_EMBEDDED_COMPILER |
24 | DROP_COMPILED_EXPRESSION_CACHE, |
25 | #endif |
26 | STOP_LISTEN_QUERIES, |
27 | START_LISTEN_QUERIES, |
28 | RESTART_REPLICAS, |
29 | RESTART_REPLICA, |
30 | SYNC_REPLICA, |
31 | RELOAD_DICTIONARY, |
32 | RELOAD_DICTIONARIES, |
33 | RELOAD_EMBEDDED_DICTIONARIES, |
34 | RELOAD_CONFIG, |
35 | STOP_MERGES, |
36 | START_MERGES, |
37 | STOP_TTL_MERGES, |
38 | START_TTL_MERGES, |
39 | STOP_FETCHES, |
40 | START_FETCHES, |
41 | STOP_MOVES, |
42 | START_MOVES, |
43 | STOP_REPLICATED_SENDS, |
44 | START_REPLICATED_SENDS, |
45 | STOP_REPLICATION_QUEUES, |
46 | START_REPLICATION_QUEUES, |
47 | FLUSH_LOGS, |
48 | FLUSH_DISTRIBUTED, |
49 | STOP_DISTRIBUTED_SENDS, |
50 | START_DISTRIBUTED_SENDS, |
51 | END |
52 | }; |
53 | |
54 | static const char * typeToString(Type type); |
55 | |
56 | Type type = Type::UNKNOWN; |
57 | |
58 | String target_dictionary; |
59 | String database; |
60 | String table; |
61 | |
62 | String getID(char) const override { return "SYSTEM query" ; } |
63 | |
64 | ASTPtr clone() const override { return std::make_shared<ASTSystemQuery>(*this); } |
65 | |
66 | ASTPtr getRewrittenASTWithoutOnCluster(const std::string & new_database) const override |
67 | { |
68 | return removeOnCluster<ASTSystemQuery>(clone(), new_database); |
69 | } |
70 | |
71 | protected: |
72 | |
73 | void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; |
74 | }; |
75 | |
76 | |
77 | } |
78 | |