-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Polars hangs for certain math ops inside a when
expression
#15975
Comments
Can not reproduce on Apple M2, Polars 0.20.21, can reproduce on 0.20.23. So a recent bug. |
It hangs in the optimizer, likely due to the new Python integer schema resolving steps. |
I will leave this one to @ritchie46 , he did those resolving steps and a simple fix causes other tests to fail. My research so far is below. There is an infinite loop because in let new_node_left = if type_left != st {
expr_arena.add(AExpr::Cast {
expr: node_left,
data_type: st.clone(),
strict: false,
})
} else {
node_left
}; However, the // Only consider unknown types equal if their inner types match.
(Unknown(l), Unknown(r)) => l == r,
} Right now any comparison between two Also, the supertype we compute is likely not correct, as in (dt, Unknown(kind)) => {
match kind {
UnknownKind::Float | UnknownKind::Int(_) if dt.is_float() | dt.is_string() => Some(dt.clone()), This results in the supertype of |
Thanks for the detailed analysis @orlp. I can easily get around this for now by simply using "1.0" instead of "1" so on my side it's not pressing. |
I have a similar problem with when/then clauses mixing integers and floats. Example:
returns:
Instead of:
|
main issue fixed by #15992 |
Checks
Issue description
When the following expression is run, polars hangs indefinitely. This only occurs when int & float are used in conjunction as in the example, and only when inside a
when/then
clause. If thewhen
is removed, the expected result is shown. There is probably a simpler example but I haven't found one so far.Installed versions
The text was updated successfully, but these errors were encountered: