#include #include #include #include #include #include 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(); 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; } }