mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-23 10:10:50 +00:00
Add style cleanup and small functional test change. [#METR-14099]
This commit is contained in:
parent
cba51f7407
commit
e136b4178a
@ -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)
|
||||
|
@ -1,8 +1,8 @@
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user