Disable projection when grouping set is used.

This commit is contained in:
Amos Bird 2022-08-29 01:18:44 +08:00
parent 4d9cfb9d05
commit abf51bccfd
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 19 additions and 0 deletions

View File

@ -5541,6 +5541,10 @@ std::optional<ProjectionCandidate> MergeTreeData::getQueryProcessingStageWithAgg
if (select_query->interpolate() && !select_query->interpolate()->children.empty())
return std::nullopt;
// Currently projections don't support GROUPING SET yet.
if (select_query->group_by_with_grouping_sets)
return std::nullopt;
auto query_options = SelectQueryOptions(
QueryProcessingStage::WithMergeableState,
/* depth */ 1,

View File

@ -0,0 +1,6 @@
a 2
a x 1
a y 1
b 2
b x 1
b y 1

View File

@ -0,0 +1,9 @@
drop table if exists test;
create table test(dim1 String, dim2 String, projection p1 (select dim1, dim2, count() group by dim1, dim2)) engine MergeTree order by dim1;
insert into test values ('a', 'x') ('a', 'y') ('b', 'x') ('b', 'y');
select dim1, dim2, count() from test group by grouping sets ((dim1, dim2), dim1) order by dim1, dim2, count();
drop table test;