Search before asking
Version
dev 1.0 or older version
What's Wrong?
select a,b, sum(c) from table group by grouping sets((a,b),(a,b,c))
This sql will fail in the analyze period cause column c could not be both in the agg function and the grouping sets.
However if i change the sql like the followings, the sql will pass the analyze.
select a,b, if (c !=null, sum(c), null) from table grouping sets((a,b),(a,b,c))
What You Expected?
Deep checks of function exprs in selectStmt are needed to ensure that the colomns in the gouping set should not in the agg function.
In this case the following sql will fail in analyze.
select a,b, if (c !=null, sum(c), null) from table grouping sets((a,b),(a,b,c))
How to Reproduce?
sql like this.
select a,b, if (c !=null, sum(c), null) from table grouping sets((a,b),(a,b,c))
Anything Else?
No
Are you willing to submit PR?
Code of Conduct