Skip to content

Commit

Permalink
Fix nested guard for Series::try_from arrow2 arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Chia committed Aug 19, 2023
1 parent 7517df1 commit 7e2ffb0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/daft-core/src/series/from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ impl TryFrom<(&str, Box<dyn arrow2::array::Array>)> for Series {
// Corner-case nested logical types that have not yet been migrated to new Array formats
// to hold only casted physical arrow arrays.
let physical_type = dtype.to_physical();
if physical_type != dtype {
if (matches!(dtype, DataType::List(..))
|| matches!(dtype, DataType::Struct(..))
|| dtype.is_extension())
&& physical_type != dtype
{
let arrow_physical_type = physical_type.to_arrow()?;
let casted_array = arrow2::compute::cast::cast(
array.as_ref(),
Expand Down

0 comments on commit 7e2ffb0

Please sign in to comment.