-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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(rust, python): allow extract of numeric from str AnyValue #13865
Conversation
I don't think we should do this this way. See my comment in issue. In any case the |
Ok I totally agree that the implementation is bad, unsure how to align with As an aside, I am trying to figure out why pl.select(pl.lit("1").cast(pl.UInt8)) # succeeds |
Yes, it goes though the |
Ok. Should I close this, or do we still want to address the associated issue? |
I think this one can be closed. It would be worth it if we got a better error message for this one. |
Hmm.. Sorry for the confusion @mcrumiller. I thought we were somewhere else in the codebase. This might work if we get more information on how to parse the string. E.g. do we need to parse as either |
Resolves #13862.
Not completely sure this is the way to go, but the reason the error is occuring is because the frame creation using a series of dicts involves adding records row-by-row to the frame. The result is the use of the
AnyValueBuffer::add_fallible()
which in turn callsAnyValue::extract()
on the read value. If the read value isstr
and the target isint
,AnyValue::extract
would panic. This adds a branch which tries to cast the string to an int, so the conversion will succeed for valid ints.