Skip to content

[Bug] deep checks between agg-function exprs and groupingsets columns are needed in SelectStmt analyze  #10120

@spaces-X

Description

@spaces-X

Search before asking

  • I had searched in the issues and found no similar issues.

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?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions