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

Probably incorrect result when the column referenced in GROUP BY is ambiguous #9162

Closed
jonahgao opened this issue Feb 8, 2024 · 2 comments · Fixed by #9228
Closed

Probably incorrect result when the column referenced in GROUP BY is ambiguous #9162

jonahgao opened this issue Feb 8, 2024 · 2 comments · Fixed by #9228
Assignees
Labels
bug Something isn't working

Comments

@jonahgao
Copy link
Member

jonahgao commented Feb 8, 2024

Describe the bug

The result might be incorrect when the column referenced in the GROUP BY clause is ambiguous; that is, when the column exists in both the select list and the input. This behavior is different from PostgreSQL.

To Reproduce

Run the following queries in DataFusion CLI .

DataFusion CLI v35.0.0
❯ create table t(a bigint);
0 rows in set. Query took 0.009 seconds.

❯ insert into t values(1),(2),(3);
+-------+
| count |
+-------+
| 3     |
+-------+
1 row in set. Query took 0.007 seconds.

❯ select 0 as "t.a" from t group by t.a;
+-----+
| t.a |
+-----+
| 0   |
+-----+
1 row in set. Query took 0.010 seconds.

Expected behavior

The result should ideally be the same as PostgreSQL, MySQL, and DuckDB.

psql => select 0 as "t.a" from t group by t.a;
 t.a
-----
   0
   0
   0
(3 rows)

Additional context

No response

@jonahgao jonahgao added the bug Something isn't working label Feb 8, 2024
@jonahgao
Copy link
Member Author

jonahgao commented Feb 8, 2024

take

@alamb
Copy link
Contributor

alamb commented Feb 8, 2024

I agree matching the other behavior would be good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants