Panic Exception with map_elements #17499
Labels
accepted
Ready for implementation
bug
Something isn't working
needs repro
Bug does not yet have a reproducible example
python
Related to Python Polars
Checks
Reproducible example
Log output
Issue description
I am currently working with a large dataset as part of a broader project modelling derailments. Because the dataset is too big to work within memory I am working almost exclusively with the Lazy API. This is one of the few exceptions where I have had to use map_elements to utilize a UDF.
For clarity this is the statement that returns the error when collected:
allDerailmentsDistance.with_columns(
pl.struct(["Section_ID", "direction", "Cone_length(m)"]).map_elements(lambda x: special_segments_covered(section_ID = x["Section_ID"],
direction = x["direction"],
cone_length = x["Cone_length(m)"]), return_dtype = pl.Int8).alias("Cone_length(sections)")
The confusing thing is that I only get an error when working with the full dataset but not when working with a subset. What is also very confusing is that this was working as intended on Friday (05/07/2024) and despite not making any changes to my code or the environment in which I am working in it now returns an error. It doesn't appear to be an issue with the RAM and streaming during collection doesn't solve the issue. Working with a DataFrame doesn't solve the issue.
Expected behavior
This is the expected output - which only works when dealing with a subset of the data.
Installed versions
The text was updated successfully, but these errors were encountered: