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

Incorrect result returned by a group by query (SQLancer-TLP) #11748

Open
2010YOUY01 opened this issue Jul 31, 2024 · 1 comment
Open

Incorrect result returned by a group by query (SQLancer-TLP) #11748

2010YOUY01 opened this issue Jul 31, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@2010YOUY01
Copy link
Contributor

Describe the bug

The below query should return an empty set, since having is evaluated after aggregation, when it's predicate is false, the final result should always be empty.
I have also checked in DuckDB and PostgreSQL, and they all return an empty set.

Reproducer in datafusion-cli

DataFusion CLI v40.0.0
> create table t1(v1 int);
0 row(s) fetched.
Elapsed 0.085 seconds.

> SELECT AVG(v1) FROM t1 GROUP BY false having false;
+------------+
| avg(t1.v1) |
+------------+
|            |
+------------+
1 row(s) fetched.
Elapsed 0.095 seconds.

To Reproduce

No response

Expected behavior

No response

Additional context

Found by SQLancer #11030

@2010YOUY01 2010YOUY01 added the bug Something isn't working label Jul 31, 2024
@Lordworms
Copy link
Contributor

take

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