ibis
ibis copied to clipboard
feat: error at construction time for illegal casts
Is your feature request related to a problem?
Consider ibis.literal(1).cast("array<int64>"). This currently doesn't error. It only errors once you try to execute the result. I don't think there is any backend where this cast would succeed. It would be great if I got this error as early as possible.
We DON'T want to be overly-sensitive, and disallow a cast that is actually implemented by a backend, but I think there are a subset of casts that we could be sure aren't illegal., and we should error earlier. Initial first thoughts:
- non-string to struct
- non-string to array
- non-string to map
- struct to non-string
- array to non-string
- map to non-string
- non-binary and non-string to geom
- geom to non-binary and non-string
What is the motivation behind your request?
I'm getting errors, but it was tricky to debug the code at fault, since it happened so much earlier.
Describe the solution you'd like
Use the already-implemented castable() function?
What version of ibis are you running?
main
What backend(s) are you using, if any?
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct