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

Referencing a column from select and order by clauses triggers duplicate expression error #13558

Open
kawadakk opened this issue Nov 25, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@kawadakk
Copy link
Contributor

kawadakk commented Nov 25, 2024

Describe the bug

Referencing a column from a certain form of select and order by clauses causes an error saying "projections require unique expression names".

To Reproduce

> create table foo as values (1, 2), (3, 4), (5, 6);
0 row(s) fetched.
Elapsed 0.002 seconds.

> select cast(column1 as text) from foo order by column1;
Error during planning: Projections require unique expression names but the expression "CAST(foo.column1 AS Utf8)" at position 0 and "foo.column1" at position 1 have the same name. Consider aliasing ("AS") one of them.

Expected behavior

Successful query execution

Additional context

DataFusion v43.0.0

@kawadakk kawadakk added the bug Something isn't working label Nov 25, 2024
@jatin510
Copy link
Contributor

take

@findepi
Copy link
Member

findepi commented Nov 25, 2024

@jatin510 what's your idea for the fix?
fwiw i tried to fix this for select clauses (#13489), but run into some fundamental issues with my approach

@jatin510
Copy link
Contributor

I was trying to modify the project function in the logical plan, builder.rs.
To give define manual cast to the projection, in which cast is not defined explicitly.

you think its good approach ? @findepi

@findepi
Copy link
Member

findepi commented Dec 2, 2024

You mean cast or alias?

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

No branches or pull requests

3 participants