This commit is contained in:
Alexey Arno 2015-04-23 14:07:15 +03:00
parent 2c067ad2c2
commit 80850909c7
4 changed files with 10 additions and 0 deletions

View File

@ -123,6 +123,8 @@ private:
void executeDistinct( BlockInputStreams & streams, bool before_order, Names columns);
void executeSubqueriesInSetsAndJoins(BlockInputStreams & streams, SubqueriesForSets & subqueries_for_sets);
void ignoreWithTotals() { query.group_by_with_totals = false; }
ASTPtr query_ptr;
ASTSelectQuery & query;
Context context;

View File

@ -610,6 +610,8 @@ QueryProcessingStage::Enum InterpreterSelectQuery::executeFetchColumns(BlockInpu
interpreter_subquery = new InterpreterSelectQuery(
query.table, subquery_context, required_columns, QueryProcessingStage::Complete, subquery_depth + 1);
if (query_analyzer->hasAggregation())
interpreter_subquery->ignoreWithTotals();
}
/// если в настройках установлен default_sample != 1, то все запросы выполняем с сэмплингом

View File

@ -0,0 +1,4 @@
1
0 0
0 0

View File

@ -0,0 +1,2 @@
SELECT count() FROM (SELECT dummy, sum(dummy) GROUP BY dummy WITH TOTALS);
SELECT * FROM (SELECT dummy, sum(dummy) GROUP BY dummy WITH TOTALS);