1 | #include <Parsers/ASTPartition.h> |
---|---|
2 | #include <IO/WriteHelpers.h> |
3 | |
4 | namespace DB |
5 | { |
6 | |
7 | String ASTPartition::getID(char delim) const |
8 | { |
9 | if (value) |
10 | return "Partition"; |
11 | else |
12 | return "Partition_ID"+ (delim + id); |
13 | } |
14 | |
15 | ASTPtr ASTPartition::clone() const |
16 | { |
17 | auto res = std::make_shared<ASTPartition>(*this); |
18 | res->children.clear(); |
19 | |
20 | if (value) |
21 | { |
22 | res->value = value->clone(); |
23 | res->children.push_back(res->value); |
24 | } |
25 | |
26 | return res; |
27 | } |
28 | |
29 | void ASTPartition::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const |
30 | { |
31 | if (value) |
32 | { |
33 | value->formatImpl(settings, state, frame); |
34 | } |
35 | else |
36 | { |
37 | settings.ostr << (settings.hilite ? hilite_keyword : "") << "ID "<< (settings.hilite ? hilite_none : ""); |
38 | WriteBufferFromOwnString id_buf; |
39 | writeQuoted(id, id_buf); |
40 | settings.ostr << id_buf.str(); |
41 | } |
42 | } |
43 | |
44 | } |
45 |