Fixes an issue with DF.new where a well placed nil could result in a panic.
Basically, the work was being done by Native.s_from_list_of_series/2 which attempted to do following:
create a list of individual polars_core::seriess each with the same dtype
create a final polars_core::series of type {:list, dtype} from that list
But because s_from_list_of_series/2 didn't have the final dtype information up front, it was possible for two elements of the intermediate list to have incompatible dtypes. When this happened, the final creation would panic.
Changes
This PR makes the dtype a required argument for:
s_from_list_of_series/3
s_from_list_of_series_as_structs/3
(Those two seemed like a pair so I made them the same.)
Description
Fixes an issue with
DF.new
where a well placednil
could result in a panic.Basically, the work was being done by
Native.s_from_list_of_series/2
which attempted to do following:polars_core::series
s each with the samedtype
polars_core::series
of type{:list, dtype}
from that listBut because
s_from_list_of_series/2
didn't have the final dtype information up front, it was possible for two elements of the intermediate list to have incompatible dtypes. When this happened, the final creation would panic.Changes
This PR makes the dtype a required argument for:
s_from_list_of_series/3
s_from_list_of_series_as_structs/3
(Those two seemed like a pair so I made them the same.)
Links
Discussion
I think there's an opportunity for optimization since we're now passing the expected dtype, but I didn't explore it.