1 | #pragma once |
---|---|
2 | |
3 | #include <Parsers/IAST.h> |
4 | |
5 | |
6 | namespace re2 |
7 | { |
8 | class RE2; |
9 | } |
10 | |
11 | |
12 | namespace DB |
13 | { |
14 | |
15 | class WriteBuffer; |
16 | |
17 | namespace ErrorCodes |
18 | { |
19 | extern const int CANNOT_COMPILE_REGEXP; |
20 | } |
21 | |
22 | struct AsteriskSemantic; |
23 | struct AsteriskSemanticImpl; |
24 | |
25 | |
26 | /** SELECT COLUMNS('regexp') is expanded to multiple columns like * (asterisk). |
27 | */ |
28 | class ASTColumnsMatcher : public IAST |
29 | { |
30 | public: |
31 | String getID(char) const override { return "ColumnsMatcher"; } |
32 | ASTPtr clone() const override; |
33 | |
34 | void appendColumnName(WriteBuffer & ostr) const override; |
35 | void setPattern(String pattern); |
36 | bool isColumnMatching(const String & column_name) const; |
37 | |
38 | protected: |
39 | void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override; |
40 | |
41 | private: |
42 | std::shared_ptr<re2::RE2> column_matcher; |
43 | String original_pattern; |
44 | std::shared_ptr<AsteriskSemanticImpl> semantic; /// pimpl |
45 | |
46 | friend struct AsteriskSemantic; |
47 | }; |
48 | |
49 | |
50 | } |
51 |