Merge branch 'master' of https://github.com/yandex/ClickHouse into CLICKHOUSE-2720

This commit is contained in:
Ivan Blinkov 2017-09-12 21:01:03 +03:00
commit 75545c74c8
3 changed files with 12 additions and 2 deletions

View File

@ -100,7 +100,7 @@ void InterpreterSelectQuery::init(const BlockInputStreamPtr & input, const Names
}
}
if (is_first_select_inside_union_all && hasAsterisk())
if (is_first_select_inside_union_all && (hasAsterisk() || hasAggregation(query)))
{
basicInit(input);
@ -126,6 +126,15 @@ void InterpreterSelectQuery::init(const BlockInputStreamPtr & input, const Names
}
}
bool InterpreterSelectQuery::hasAggregation(const ASTSelectQuery & query_ptr)
{
for (const ASTSelectQuery * elem = &query_ptr; elem; elem = static_cast<const ASTSelectQuery *>(elem->next_union_all.get()))
if (elem->group_expression_list || elem->having_expression)
return true;
return false;
}
void InterpreterSelectQuery::basicInit(const BlockInputStreamPtr & input)
{
auto query_table = query.table();

View File

@ -96,6 +96,7 @@ private:
void init(const BlockInputStreamPtr & input, const Names & required_column_names = Names{});
void basicInit(const BlockInputStreamPtr & input);
void initQueryAnalyzer();
bool hasAggregation(const ASTSelectQuery & query_ptr);
/// Execute one SELECT query from the UNION ALL chain.
void executeSingleQuery();

View File

@ -165,7 +165,7 @@
on the market. It&nbsp;processes hundreds of millions to more than a billion rows and tens of gigabytes of data
per single server per second.</p>
<p>ClickHouse uses all available hardware to it's full potential to process each query as fast as possible. The peak
<p>ClickHouse uses all available hardware to its full potential to process each query as fast as possible. The peak
processing performance for a single query <span class="grey">(after decompression, only used columns)</span>
stands at more than 2&nbsp;terabytes per second.</p>
</div>