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

fix(datatypes): give a more useful error message when trying to cast structs with different fields #10214

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

NickCrews
Copy link
Contributor

Before, this would error with a KeyError

Before, this would error with a KeyError
@github-actions github-actions bot added tests Issues or PRs related to tests datatypes Issues relating to ibis's datatypes (under `ibis.expr.datatypes`) labels Sep 24, 2024
@cpcloud
Copy link
Member

cpcloud commented Sep 24, 2024

Thanks!

Is there a user-facing API implication here?

@NickCrews
Copy link
Contributor Author

NickCrews commented Sep 24, 2024

Is there a user-facing API implication here?

The included test case is the simplest public API I could think of (Datatype.castable() is documented on the website), but I actually discovered it when merging two incompatible array<struct>s

x = ibis.struct({"x": 5})
y = ibis.struct({"y": 7})
ibis.array([x]).concat(ibis.array([y]))

Copy link
Member

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cpcloud cpcloud changed the title fix: handle when structs have different fields in castable() fix(datatypes): handle when structs have different fields in castable() Sep 25, 2024
@cpcloud cpcloud changed the title fix(datatypes): handle when structs have different fields in castable() fix(datatypes): give a more useful error message when trying to cast structs with different fields Sep 25, 2024
@cpcloud cpcloud added this to the 10.0 milestone Sep 25, 2024
@cpcloud cpcloud merged commit d3496fd into ibis-project:main Sep 25, 2024
79 checks passed
@cpcloud cpcloud added the ux User experience related issues label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datatypes Issues relating to ibis's datatypes (under `ibis.expr.datatypes`) tests Issues or PRs related to tests ux User experience related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants