-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Non-aggregation expressions should be included in the grouping keys #11903
Labels
bug
Something isn't working
Comments
I did some tests. If I don't provide any group-by key, the SQL will fail.
However, if I provide at least 1 group-by key, DataFusion will add the others to the group-by key implicitly.
|
hmm.. Ok, I found #6190 mentioned it's an optimization for the primary key and unique key. I think it may not be an issue. I'll close this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I noticed that the behavior of some tests is unusual.
datafusion/datafusion/sqllogictest/test_files/group_by.slt
Lines 3481 to 3487 in b5d7931
Typically, non-aggregation expressions should appear in the GROUP BY clause. Other databases do not allow this behavior.
DuckDB
Postgres
I modified the SQL to fix the scoping issue. However, both DuckDB and Postgres require that the dimensions (
sn
andamount
) appear in theGROUP BY
clause. In my experience, most databases follow similar behavior.To Reproduce
As the above.
Expected behavior
This case should fail:
We should provide all non-aggregation expressions in the group-by clause
Additional context
I'm working on #11681 now. I guess it can also fix this issue partially. However, another case as below won't be fixed.
The text was updated successfully, but these errors were encountered: