Analyzer: do not optimize GROUP BY keys with ROLLUP and CUBE

This commit is contained in:
Dmitry Novik 2023-05-12 14:36:54 +00:00
parent 5629d73bdb
commit d2e185d86d
3 changed files with 18 additions and 0 deletions

View File

@ -38,6 +38,9 @@ public:
if (!query->hasGroupBy())
return;
if (query->isGroupByWithCube() || query->isGroupByWithRollup())
return;
auto & group_by = query->getGroupBy().getNodes();
if (query->isGroupByWithGroupingSets())
{

View File

@ -0,0 +1,8 @@
a b
a b
a b
b
a b
a b
a b
a b

View File

@ -0,0 +1,7 @@
SELECT 'a' AS key, 'b' as value GROUP BY key WITH CUBE SETTINGS allow_experimental_analyzer = 0;
SELECT 'a' AS key, 'b' as value GROUP BY key WITH CUBE SETTINGS allow_experimental_analyzer = 1;
SELECT 'a' AS key, 'b' as value GROUP BY ignore(1) WITH CUBE;
SELECT 'a' AS key, 'b' as value GROUP BY ignore(1);
SELECT 'a' AS key, 'b' as value GROUP BY key;