blob: 75a8ae0415ea9050cdadc9d1fefdbcc97e20c7ec (
plain) (
blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#pragma once
#include <Parsers/IAST.h>
#include <base/types.h>
namespace DB
{
/// Pair with name and value in lisp programming langugate style. It contain
/// string as key, but value either can be literal or list of
/// pairs.
class ASTPair : public IAST
{
public:
/// Name or key of pair
String first;
/// Value of pair, which can be also list of pairs
IAST * second = nullptr;
/// Value is closed in brackets (HOST '127.0.0.1')
bool second_with_brackets;
explicit ASTPair(bool second_with_brackets_)
: second_with_brackets(second_with_brackets_)
{
}
String getID(char delim) const override;
ASTPtr clone() const override;
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
bool hasSecretParts() const override;
void updateTreeHashImpl(SipHash & hash_state) const override;
void forEachPointerToChild(std::function<void(void**)> f) override
{
f(reinterpret_cast<void **>(&second));
}
};
/// Function with key-value arguments is a function which arguments consist of
/// pairs (see above). For example:
/// ->Pair with list of pairs as value<-
/// SOURCE(USER 'clickhouse' PORT 9000 REPLICA(HOST '127.0.0.1' PRIORITY 1) TABLE 'some_table')
class ASTFunctionWithKeyValueArguments : public IAST
{
public:
/// Name of function
String name;
/// Expression list
ASTPtr elements;
/// Has brackets around arguments
bool has_brackets;
explicit ASTFunctionWithKeyValueArguments(bool has_brackets_ = true)
: has_brackets(has_brackets_)
{
}
String getID(char delim) const override;
ASTPtr clone() const override;
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override;
void updateTreeHashImpl(SipHash & hash_state) const override;
};
}
|