mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
59 lines
2.0 KiB
C++
59 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include <Parsers/IParser.h>
|
|
#include <Parsers/IParserBase.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Parser for dictionary lifetime part. It should contain "lifetime" keyword,
|
|
/// opening bracket, literal value or two pairs and closing bracket:
|
|
/// lifetime(300), lifetime(min 100 max 200). Produces ASTDictionaryLifetime.
|
|
class ParserDictionaryLifetime : public IParserBase
|
|
{
|
|
protected:
|
|
const char * getName() const override { return "lifetime definition"; }
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
};
|
|
|
|
/// Parser for dictionary range part. It should contain "range" keyword opening
|
|
/// bracket, two pairs and closing bracket: range(min attr1 max attr2). Produces
|
|
/// ASTDictionaryRange.
|
|
class ParserDictionaryRange : public IParserBase
|
|
{
|
|
protected:
|
|
const char * getName() const override { return "range definition"; }
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
};
|
|
|
|
|
|
/// Parser for dictionary layout part. It should contain "layout" keyword,
|
|
/// opening bracket, possible pair with param value and closing bracket:
|
|
/// layout(type()) or layout(type(param value)). Produces ASTDictionaryLayout.
|
|
class ParserDictionaryLayout : public IParserBase
|
|
{
|
|
protected:
|
|
const char * getName() const override { return "layout definition"; }
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
};
|
|
|
|
|
|
/// Combines together all parsers from above and also parses primary key and
|
|
/// dictionary source, which consists of custom key-value pairs:
|
|
///
|
|
/// PRIMARY KEY key_column1, key_column2
|
|
/// SOURCE(MYSQL(HOST 'localhost' PORT 9000 USER 'default' REPLICA(HOST '127.0.0.1' PRIORITY 1) PASSWORD ''))
|
|
/// LAYOUT(CACHE(size_in_cells 50))
|
|
/// LIFETIME(MIN 1 MAX 10)
|
|
/// RANGE(MIN second_column MAX third_column)
|
|
///
|
|
/// Produces ASTDictionary.
|
|
class ParserDictionary : public IParserBase
|
|
{
|
|
protected:
|
|
const char * getName() const override { return "dictionary definition"; }
|
|
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
|
};
|
|
|
|
}
|