ClickHouse/src/Parsers/ParserDescribeTableQuery.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1013 B
C++
Raw Normal View History

#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;
query->children.push_back(std::move(table_expression));
query->table_expression = query->children.back();
node = query;
return true;
}
}