-
Notifications
You must be signed in to change notification settings - Fork 605
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: type error when accessing length()
without schema information
#10651
Comments
I can't reproduce this on
|
The code works. It's the static type checking that outputs an error while it should not. |
Schema information generally can't be made static in Python. A type checker would need access to information from a running database. |
Of course, but in this case I think the DX would be much better if instead of assuming that the column can't be a list, we assume it could be, and prevent the type checker from erroring Right now I have to do from typing import cast
from ibis.expr.types import ArrayColumn
t.select(t).filter(
cast(ArrayColumn, t.my_list_column).length() > ibis.literal(0)
) (type checking also requires me to write More and more projects use type checking, and not having it in ibis will prevent all of them from having a good DX and reduce ibis' adoption. |
It sounds like you effectively want every type-specific method to exist on |
That could be a solution. Maybe there's another one which does not imply modifying the |
In that case a giant If this pattern shows up in a bunch of places maybe we can make a type alias to simplify our lives. |
What happened?
The following example is self-explanatory
By default, it's assumed that
t.some_col
is of typeColumn
, while it could be of typeArrayColumn
(or other more specific types for that matter).This results in typing issues.
What version of ibis are you using?
9.5.0
What backend(s) are you using, if any?
DuckDB
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: