mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 05:00:47 +00:00
Better UNION ALL: development #1947
This commit is contained in:
parent
ac37b89b16
commit
44d0736138
@ -913,7 +913,7 @@ StoragePtr ExpressionAnalyzer::getTable()
|
|||||||
auto select_table = select->table();
|
auto select_table = select->table();
|
||||||
|
|
||||||
if (select_table
|
if (select_table
|
||||||
&& !typeid_cast<const ASTSelectQuery *>(select_table.get())
|
&& !typeid_cast<const ASTSelectWithUnionQuery *>(select_table.get())
|
||||||
&& !typeid_cast<const ASTFunction *>(select_table.get()))
|
&& !typeid_cast<const ASTFunction *>(select_table.get()))
|
||||||
{
|
{
|
||||||
String database = select_database
|
String database = select_database
|
||||||
|
@ -135,6 +135,11 @@ BlockInputStreams InterpreterSelectWithUnionQuery::executeWithMultipleStreams()
|
|||||||
nested_streams.insert(nested_streams.end(), streams.begin(), streams.end());
|
nested_streams.insert(nested_streams.end(), streams.begin(), streams.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Unify data structure.
|
||||||
|
if (nested_interpreters.size() > 1)
|
||||||
|
for (auto & stream : nested_streams)
|
||||||
|
stream = std::make_shared<ConvertingBlockInputStream>(context, stream, result_header, ConvertingBlockInputStream::MatchColumnsMode::Position);
|
||||||
|
|
||||||
return nested_streams;
|
return nested_streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,11 +160,6 @@ BlockIO InterpreterSelectWithUnionQuery::execute()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/// Unify data structure.
|
|
||||||
if (nested_interpreters.size() > 1)
|
|
||||||
for (auto & stream : nested_streams)
|
|
||||||
stream = std::make_shared<ConvertingBlockInputStream>(context, stream, result_header, ConvertingBlockInputStream::MatchColumnsMode::Position);
|
|
||||||
|
|
||||||
result_stream = std::make_shared<UnionBlockInputStream<>>(nested_streams, nullptr, context.getSettingsRef().max_threads);
|
result_stream = std::make_shared<UnionBlockInputStream<>>(nested_streams, nullptr, context.getSettingsRef().max_threads);
|
||||||
nested_streams.clear();
|
nested_streams.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user