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

bug: duplicate column names in filters leads to error #9474

Closed
1 task done
NickCrews opened this issue Jun 29, 2024 · 2 comments · Fixed by #9476
Closed
1 task done

bug: duplicate column names in filters leads to error #9474

NickCrews opened this issue Jun 29, 2024 · 2 comments · Fixed by #9476
Labels
bug Incorrect behavior inside of ibis
Milestone

Comments

@NickCrews
Copy link
Contributor

What happened?

import ibis

t = ibis.examples.penguins.fetch()
t.filter(
    t.species == "Adelie",
    t.species == "Adelie",
)
# IbisInputError: Duplicate column name "Equals(species, 'Adelie')" in result set

Since neither of these columns are actually in the result set, I would expect this to work.

OK, I admit this is a bit of a contrived example, but there are instances where different expressions have the same name, which is how I actually ran into this bug:

t.filter(
    t.island.fill_null("") == "Adelie",
    t.species.fill_null("") == "Adelie",
)
# IbisInputError: Duplicate column name "Equals(Coalesce(), 'Adelie')" in result set

perhaps that is just a bug with coalesce though? We should make them have different names?

I think the "pure" solution would be to do some renaming of these temporary columns on the fly inside .filter(), but that might be really hairy, so an easier mitigation would be just to stamp out instances where different expressions map to the same name.

What version of ibis are you using?

main

What backend(s) are you using, if any?

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@NickCrews NickCrews added the bug Incorrect behavior inside of ibis label Jun 29, 2024
@cpcloud
Copy link
Member

cpcloud commented Jun 29, 2024

I think the "pure" solution would be to do some renaming of these temporary columns on the fly inside .filter()

I don't think so. I think we might want to instead relax whatever constraint is enforcing this, but only inside filter. Best to look into what's happening before we speculate on solutions though :)

@cpcloud
Copy link
Member

cpcloud commented Jun 29, 2024

I think the expression naming collision in this case is also an issue, as the same problem shows up in a select invocation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants