提交 e136b417 编写于 作者: A Alexey Arno

Add style cleanup and small functional test change. [#METR-14099]

上级 cba51f74
......@@ -88,14 +88,14 @@ void InterpreterSelectQuery::init(BlockInputStreamPtr input_, const NamesAndType
if (isFirstSelectInsideUnionAll())
{
// Создаем цепочку запросов SELECT и проверяем, что результаты всех запросов SELECT cовместимые.
// Создаем цепочку запросов SELECT и проверяем, что результаты всех запросов SELECT cовместимые.
// NOTE Мы можем безопасно применить static_cast вместо typeid_cast,
// потому что знаем, что в цепочке UNION ALL имеются только деревья типа SELECT.
InterpreterSelectQuery * interpreter = this;
Block first = interpreter->getSampleBlock();
for (ASTPtr tree = query.next_union_all; !tree.isNull(); tree = (static_cast<ASTSelectQuery &>(*tree)).next_union_all)
{
interpreter->next_select_in_union_all.reset(new InterpreterSelectQueryWithContext(tree, context, to_stage, subquery_depth, nullptr, false));
interpreter->next_select_in_union_all.reset(new InterpreterSelectQueryWithContext(tree, context, to_stage, subquery_depth, nullptr, false));
interpreter = &(interpreter->next_select_in_union_all->query);
Block current = interpreter->getSampleBlock();
if (!blocksHaveEqualStructure(first, current))
......
......@@ -239,16 +239,16 @@ void formatAST(const ASTSelectQuery & ast, std::ostream & s, size_t indent, bo
formatAST(*ast.format, s, indent, hilite, one_line);
}
if (ast.next_union_all)
{
s << (hilite ? hilite_keyword : "") << nl_or_ws << indent_str << "UNION ALL " << nl_or_ws << (hilite ? hilite_none : "");
if (ast.next_union_all)
{
s << (hilite ? hilite_keyword : "") << nl_or_ws << indent_str << "UNION ALL " << nl_or_ws << (hilite ? hilite_none : "");
// NOTE Мы можем безопасно применить static_cast вместо typeid_cast, потому что знаем, что в цепочке UNION ALL
// имеются только деревья типа SELECT.
const ASTSelectQuery & next_ast = static_cast<const ASTSelectQuery &>(*ast.next_union_all);
// NOTE Мы можем безопасно применить static_cast вместо typeid_cast, потому что знаем, что в цепочке UNION ALL
// имеются только деревья типа SELECT.
const ASTSelectQuery & next_ast = static_cast<const ASTSelectQuery &>(*ast.next_union_all);
formatAST(next_ast, s, indent, hilite, one_line, need_parens);
}
formatAST(next_ast, s, indent, hilite, one_line, need_parens);
}
}
void formatAST(const ASTSubquery & ast, std::ostream & s, size_t indent, bool hilite, bool one_line, bool need_parens)
......
DROP TABLE IF EXISTS data2013;
DROP TABLE IF EXISTS data2014;
CREATE TABLE data2013 (name String, value UInt32) ENGINE = TinyLog;
CREATE TABLE data2014 (name String, value UInt32) ENGINE = TinyLog;
CREATE TABLE data2013 (name String, value UInt32) ENGINE = Memory;
CREATE TABLE data2014 (name String, value UInt32) ENGINE = Memory;
INSERT INTO data2013(name,value) VALUES('Alice', 1000);
INSERT INTO data2013(name,value) VALUES('Bob', 2000);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册