Fix optimize_trivial_count_query for queries with GROUP BY

Fixes: 00341_squashing_insert_select2
This commit is contained in:
Azat Khuzhin 2020-03-29 18:11:03 +03:00
parent 85df027651
commit 3d3a82543a

View File

@ -1064,7 +1064,7 @@ void InterpreterSelectQuery::executeFetchColumns(
auto check_trivial_count_query = [&]() -> std::optional<AggregateDescription>
{
if (!settings.optimize_trivial_count_query || !syntax_analyzer_result->maybe_optimize_trivial_count || !storage
|| query.sampleSize() || query.sampleOffset() || query.final() || query.prewhere() || query.where()
|| query.sampleSize() || query.sampleOffset() || query.final() || query.prewhere() || query.where() || query.groupBy()
|| !query_analyzer->hasAggregation() || processing_stage != QueryProcessingStage::FetchColumns)
return {};