| 15 | { |
| 16 | |
| 17 | bool ParserExplainQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) |
| 18 | { |
| 19 | ASTExplainQuery::ExplainKind kind = {}; |
| 20 | |
| 21 | ParserKeyword s_ast(Keyword::AST); |
| 22 | ParserKeyword s_explain(Keyword::EXPLAIN); |
| 23 | ParserKeyword s_syntax(Keyword::SYNTAX); |
| 24 | ParserKeyword s_query_tree(Keyword::QUERY_TREE); |
| 25 | ParserKeyword s_pipeline(Keyword::PIPELINE); |
| 26 | ParserKeyword s_plan(Keyword::PLAN); |
| 27 | ParserKeyword s_estimates(Keyword::ESTIMATE); |
| 28 | ParserKeyword s_table_override(Keyword::TABLE_OVERRIDE); |
| 29 | ParserKeyword s_current_transaction(Keyword::CURRENT_TRANSACTION); |
| 30 | ParserKeyword s_whatif(Keyword::WHATIF); |
| 31 | |
| 32 | if (s_explain.ignore(pos, expected)) |
| 33 | { |
| 34 | kind = ASTExplainQuery::QueryPlan; |
| 35 | |
| 36 | if (s_ast.ignore(pos, expected)) |
| 37 | kind = ASTExplainQuery::ExplainKind::ParsedAST; |
| 38 | else if (s_syntax.ignore(pos, expected)) |
| 39 | kind = ASTExplainQuery::ExplainKind::AnalyzedSyntax; |
| 40 | else if (s_query_tree.ignore(pos, expected)) |
| 41 | kind = ASTExplainQuery::ExplainKind::QueryTree; |
| 42 | else if (s_pipeline.ignore(pos, expected)) |
| 43 | kind = ASTExplainQuery::ExplainKind::QueryPipeline; |
| 44 | else if (s_plan.ignore(pos, expected)) |
| 45 | kind = ASTExplainQuery::ExplainKind::QueryPlan; |
| 46 | else if (s_estimates.ignore(pos, expected)) |
| 47 | kind = ASTExplainQuery::ExplainKind::QueryEstimates; |
| 48 | else if (s_table_override.ignore(pos, expected)) |
| 49 | kind = ASTExplainQuery::ExplainKind::TableOverride; |
| 50 | else if (s_current_transaction.ignore(pos, expected)) |
| 51 | kind = ASTExplainQuery::ExplainKind::CurrentTransaction; |
| 52 | else if (s_whatif.ignore(pos, expected)) |
| 53 | kind = ASTExplainQuery::ExplainKind::WhatIf; |
| 54 | } |
| 55 | else |
| 56 | return false; |
| 57 | |
| 58 | auto explain_query = make_intrusive<ASTExplainQuery>(kind); |
| 59 | |
| 60 | { |
| 61 | ASTPtr settings; |
| 62 | ParserSetQuery parser_settings(true, false); |
| 63 | |
| 64 | auto begin = pos; |
| 65 | if (parser_settings.parse(pos, settings, expected)) |
| 66 | explain_query->setSettings(std::move(settings)); |
| 67 | else |
| 68 | pos = begin; |
| 69 | } |
| 70 | |
| 71 | ParserCreateTableQuery create_p; |
| 72 | ParserSelectWithUnionQuery select_p; |
| 73 | ParserInsertQuery insert_p(end, allow_settings_after_format_in_insert); |
| 74 | ParserSystemQuery system_p; |
nothing calls this directly
no test coverage detected