ClickHouse/src/Parsers/ASTColumnsMatcher.h

51 lines
964 B
C++
Raw Normal View History

2019-07-12 11:17:38 +00:00
#pragma once
#include <Parsers/IAST.h>
2019-07-16 20:05:00 +00:00
namespace re2
{
class RE2;
}
2019-07-12 11:17:38 +00:00
namespace DB
{
2019-07-16 20:05:00 +00:00
class WriteBuffer;
2019-07-12 11:17:38 +00:00
namespace ErrorCodes
{
}
struct AsteriskSemantic;
struct AsteriskSemanticImpl;
2019-07-16 20:05:00 +00:00
/** SELECT COLUMNS('regexp') is expanded to multiple columns like * (asterisk).
*/
2019-07-21 17:03:58 +00:00
class ASTColumnsMatcher : public IAST
2019-07-12 11:17:38 +00:00
{
public:
2019-07-21 17:03:58 +00:00
String getID(char) const override { return "ColumnsMatcher"; }
2019-07-12 11:17:38 +00:00
ASTPtr clone() const override;
2019-07-16 20:05:00 +00:00
2019-07-12 11:17:38 +00:00
void appendColumnName(WriteBuffer & ostr) const override;
2019-07-16 20:05:00 +00:00
void setPattern(String pattern);
bool isColumnMatching(const String & column_name) const;
2020-08-20 02:01:40 +00:00
void updateTreeHashImpl(SipHash & hash_state) const override;
2019-07-12 11:17:38 +00:00
protected:
void formatImpl(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
private:
2019-07-16 20:05:00 +00:00
std::shared_ptr<re2::RE2> column_matcher;
String original_pattern;
2019-07-12 11:17:38 +00:00
std::shared_ptr<AsteriskSemanticImpl> semantic; /// pimpl
friend struct AsteriskSemantic;
};
}