blob: fcfc4799dbec7c9fdd13450889803dd6be28033e (
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
|
#include <Parsers/TablePropertiesQueriesASTs.h>
#include <Parsers/CommonParsers.h>
#include <Parsers/ParserDescribeTableQuery.h>
#include <Parsers/ParserTablesInSelectQuery.h>
#include <Parsers/ParserSetQuery.h>
#include <Common/typeid_cast.h>
namespace DB
{
bool ParserDescribeTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ParserKeyword s_describe("DESCRIBE");
ParserKeyword s_desc("DESC");
ParserKeyword s_table("TABLE");
ParserKeyword s_settings("SETTINGS");
ParserToken s_dot(TokenType::Dot);
ParserIdentifier name_p;
ParserSetQuery parser_settings(true);
ASTPtr database;
ASTPtr table;
if (!s_describe.ignore(pos, expected) && !s_desc.ignore(pos, expected))
return false;
auto query = std::make_shared<ASTDescribeQuery>();
s_table.ignore(pos, expected);
if (!ParserTableExpression().parse(pos, query->table_expression, expected))
return false;
/// For compatibility with SELECTs, where SETTINGS can be in front of FORMAT
ASTPtr settings;
if (s_settings.ignore(pos, expected))
{
if (!parser_settings.parse(pos, query->settings_ast, expected))
return false;
}
query->children.push_back(query->table_expression);
if (query->settings_ast)
query->children.push_back(query->settings_ast);
node = query;
return true;
}
}
|