blob: 505b95bda8efa2b52eccb5163f40bdeba44944ea (
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
|
#include <Parsers/ParserCheckQuery.h>
#include <Parsers/CommonParsers.h>
#include <Parsers/ExpressionElementParsers.h>
#include <Parsers/ASTCheckQuery.h>
#include <Parsers/ParserPartition.h>
#include <Parsers/parseDatabaseAndTableName.h>
namespace DB
{
bool ParserCheckQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ParserKeyword s_check_table("CHECK TABLE");
ParserKeyword s_partition("PARTITION");
ParserToken s_dot(TokenType::Dot);
ParserPartition partition_parser;
if (!s_check_table.ignore(pos, expected))
return false;
auto query = std::make_shared<ASTCheckQuery>();
if (!parseDatabaseAndTableAsAST(pos, expected, query->database, query->table))
return false;
if (s_partition.ignore(pos, expected))
{
if (!partition_parser.parse(pos, query->partition, expected))
return false;
}
if (query->database)
query->children.push_back(query->database);
if (query->table)
query->children.push_back(query->table);
node = query;
return true;
}
}
|