1#include <Parsers/ASTSubquery.h>
2#include <Parsers/ExpressionElementParsers.h>
3#include <Parsers/ParserSelectQuery.h>
4#include <Parsers/ParserUnionQueryElement.h>
5#include <Common/typeid_cast.h>
6
7
8namespace DB
9{
10
11bool ParserUnionQueryElement::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
12{
13 if (!ParserSubquery().parse(pos, node, expected) && !ParserSelectQuery().parse(pos, node, expected))
14 return false;
15
16 if (const auto * ast_subquery = node->as<ASTSubquery>())
17 node = ast_subquery->children.at(0);
18
19 return true;
20}
21
22}
23