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

Regression since 45.0.0: select count(), count(*) does not work #14855

Closed
Tracked by #14123
alamb opened this issue Feb 24, 2025 · 1 comment · Fixed by #14824
Closed
Tracked by #14123

Regression since 45.0.0: select count(), count(*) does not work #14855

alamb opened this issue Feb 24, 2025 · 1 comment · Fixed by #14824
Labels
bug Something isn't working regression Something that used to work no longer does

Comments

@alamb
Copy link
Contributor

alamb commented Feb 24, 2025

Describe the bug

@jonahgao noticed this in #14824

This query works in DataFusion 44 and 45:

select count(), count(*);

However, it does not work on main (what would become DataFusion 46)

DataFusion CLI v45.0.0
> select count(), count(*);
Error during planning: Projections require unique expression names but the expression "count(*)" at position 0 and "count(*)" at position 1 have the same name. Consider aliasing ("AS") one of them.
>

To Reproduce

No response

Expected behavior

The query should produce the same results as in datafusion 44 and 45

andrewlamb@Andrews-MacBook-Pro-2:~/Software/datafusion$ ~/Downloads/datafusion-cli-44
DataFusion CLI v44.0.0
> select count(), count(*);
+---------+----------+
| count() | count(*) |
+---------+----------+
| 1       | 1        |
+---------+----------+
1 row(s) fetched.
Elapsed 0.013 seconds.

>
\q
andrewlamb@Andrews-MacBook-Pro-2:~/Software/datafusion$ ~/Downloads/datafusion-cli-45
DataFusion CLI v45.0.0
> select count(), count(*);
+---------+----------+
| count() | count(*) |
+---------+----------+
| 1       | 1        |
+---------+----------+
1 row(s) fetched.
Elapsed 0.013 seconds.

Additional context

It is likely this was introduced by

There is more discussion on

@alamb alamb added bug Something isn't working regression Something that used to work no longer does labels Feb 24, 2025
@jonahgao
Copy link
Member

Another similar case is

DataFusion CLI v45.0.0
> select count(*), count(t.*) from (values(1)) t(a);
Error during planning: Projections require unique expression names but the expression "count(*)" at position 0 and "count(*)" at position 1 have the same name. Consider aliasing ("AS") one of them.

It can be passed in PostgreSQL and DataFusion 45.

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

Successfully merging a pull request may close this issue.

2 participants