Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GroupBy dimension not work, need replace with distinct #321

Open
Lvnszn opened this issue Apr 27, 2023 · 3 comments
Open

GroupBy dimension not work, need replace with distinct #321

Lvnszn opened this issue Apr 27, 2023 · 3 comments

Comments

@Lvnszn
Copy link

Lvnszn commented Apr 27, 2023

select cname from dual group by cname

the sql will return the same value in one column.

@cube2222
Copy link
Owner

I think this is a bug in the current sql->logical plan transform.

Right now it treats a query as a grouping if there's at least one aggregate function (so it works for whole-table aggregates).

This could be fixed to treat a query as a grouping if there's either at least on aggregate function, or at least one grouped-by field.

@Lvnszn
Copy link
Author

Lvnszn commented May 10, 2023

how do i fix this bug?

@cube2222
Copy link
Owner

You can try to change the ParseSelect function in parser/parser.go so that isGroupBy is true not only when there's an aggregate used, but when statement.GroupBy is non-empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants