| 1 | #pragma once | 
|---|
| 2 |  | 
|---|
| 3 | #include <Parsers/IAST.h> | 
|---|
| 4 | #include <Core/Types.h> | 
|---|
| 5 |  | 
|---|
| 6 | namespace DB | 
|---|
| 7 | { | 
|---|
| 8 |  | 
|---|
| 9 | /// Pair with name and value in lisp programming langugate style. It contain | 
|---|
| 10 | /// string as key, but value either can be literal or list of | 
|---|
| 11 | /// pairs. | 
|---|
| 12 | class ASTPair : public IAST | 
|---|
| 13 | { | 
|---|
| 14 | public: | 
|---|
| 15 | /// Name or key of pair | 
|---|
| 16 | String first; | 
|---|
| 17 | /// Value of pair, which can be also list of pairs | 
|---|
| 18 | ASTPtr second; | 
|---|
| 19 | /// Value is closed in brackets (HOST '127.0.0.1') | 
|---|
| 20 | bool second_with_brackets; | 
|---|
| 21 |  | 
|---|
| 22 | public: | 
|---|
| 23 | ASTPair(bool second_with_brackets_) | 
|---|
| 24 | : second_with_brackets(second_with_brackets_) | 
|---|
| 25 | { | 
|---|
| 26 | } | 
|---|
| 27 |  | 
|---|
| 28 | String getID(char delim) const override; | 
|---|
| 29 |  | 
|---|
| 30 | ASTPtr clone() const override; | 
|---|
| 31 |  | 
|---|
| 32 | void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; | 
|---|
| 33 | }; | 
|---|
| 34 |  | 
|---|
| 35 |  | 
|---|
| 36 | /// Function with key-value arguments is a function which arguments consist of | 
|---|
| 37 | /// pairs (see above). For example: | 
|---|
| 38 | ///                                    ->Pair with list of pairs as value<- | 
|---|
| 39 | /// SOURCE(USER 'clickhouse' PORT 9000 REPLICA(HOST '127.0.0.1' PRIORITY 1) TABLE 'some_table') | 
|---|
| 40 | class ASTFunctionWithKeyValueArguments : public IAST | 
|---|
| 41 | { | 
|---|
| 42 | public: | 
|---|
| 43 | /// Name of function | 
|---|
| 44 | String name; | 
|---|
| 45 | /// Expression list | 
|---|
| 46 | ASTPtr elements; | 
|---|
| 47 |  | 
|---|
| 48 | public: | 
|---|
| 49 | String getID(char delim) const override; | 
|---|
| 50 |  | 
|---|
| 51 | ASTPtr clone() const override; | 
|---|
| 52 |  | 
|---|
| 53 | void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override; | 
|---|
| 54 | }; | 
|---|
| 55 |  | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|