2017-11-01 14:34:05 +00:00
|
|
|
#include <Parsers/TablePropertiesQueriesASTs.h>
|
|
|
|
|
|
|
|
#include <Parsers/CommonParsers.h>
|
|
|
|
#include <Parsers/ParserDescribeTableQuery.h>
|
|
|
|
#include <Parsers/ParserTablesInSelectQuery.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");
|
|
|
|
ParserToken s_dot(TokenType::Dot);
|
|
|
|
ParserIdentifier name_p;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
ASTPtr table_expression;
|
|
|
|
if (!ParserTableExpression().parse(pos, table_expression, expected))
|
|
|
|
return false;
|
|
|
|
|
2022-10-11 13:50:42 +00:00
|
|
|
query->children.push_back(std::move(table_expression));
|
|
|
|
query->table_expression = query->children.back();
|
2017-11-01 14:34:05 +00:00
|
|
|
|
|
|
|
node = query;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|