I'm trying to do a GROUP BY CUBE() with 8 different elements in Snowflake but based on the documentation, "Snowflake allows up to 7 elements (equivalent to 128 grouping sets) in each cube".
This is a limitation for one of the queries I need to run. The basic form of the query looks like
SELECT A, B, C, D, E, F, G, H
FROM (
SELECT '1' AS A, '2' AS B, '3' AS C, '4' AS D, '5' AS E, '6' AS F, '7' AS G, 8 AS H
) SUB
GROUP BY CUBE(A,B,C,D,E,F,G,H);
If column H is removed, it works just fine. But when I add H to the query, I get
SQL compilation error: Number of grouping sets (256) exceeds maximum number of grouping sets allowed (128)
What would be the way to go to get the same results of a GROUP BY CUBE with 8 elements? I did some research and it looks like GROUP BY GROUPING SETS could work but there's still the 128 grouping sets limit in the same query block.