1#include <Parsers/TablePropertiesQueriesASTs.h>
2
3#include <Parsers/CommonParsers.h>
4#include <Parsers/ParserDescribeTableQuery.h>
5#include <Parsers/ParserTablesInSelectQuery.h>
6
7#include <Common/typeid_cast.h>
8
9
10namespace DB
11{
12
13
14bool ParserDescribeTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
15{
16 ParserKeyword s_describe("DESCRIBE");
17 ParserKeyword s_desc("DESC");
18 ParserKeyword s_table("TABLE");
19 ParserToken s_dot(TokenType::Dot);
20 ParserIdentifier name_p;
21
22 ASTPtr database;
23 ASTPtr table;
24
25 if (!s_describe.ignore(pos, expected) && !s_desc.ignore(pos, expected))
26 return false;
27
28 auto query = std::make_shared<ASTDescribeQuery>();
29
30 s_table.ignore(pos, expected);
31
32 ASTPtr table_expression;
33 if (!ParserTableExpression().parse(pos, table_expression, expected))
34 return false;
35
36 query->table_expression = table_expression;
37
38 node = query;
39
40 return true;
41}
42
43
44}
45