Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Mar 14, 2024
1 parent 7e60575 commit 4126c01
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/polars-core/src/chunked_array/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl ChunkCast for ListChunked {
(dt, Categorical(None, _) | Enum(_, _))
if !matches!(dt, Categorical(_, _) | Enum(_, _) | String | Null) =>
{
polars_bail!(ComputeError: "cannot cast List inner type: '{:?}' to Categorical", dt)
polars_bail!(InvalidOperation: "cannot cast List inner type: '{:?}' to Categorical", dt)
},
_ => {
// ensure the inner logical type bubbles up
Expand Down Expand Up @@ -418,7 +418,7 @@ impl ChunkCast for ListChunked {
},
_ => {
polars_bail!(
ComputeError: "cannot cast List type (inner: '{:?}', to: '{:?}')",
InvalidOperation: "cannot cast List type (inner: '{:?}', to: '{:?}')",
self.inner_dtype(),
data_type,
)
Expand Down Expand Up @@ -452,7 +452,7 @@ impl ChunkCast for ArrayChunked {
(old, new) if old == *new => Ok(self.clone().into_series()),
#[cfg(feature = "dtype-categorical")]
(dt, Categorical(None, _) | Enum(_, _)) if !matches!(dt, String) => {
polars_bail!(InvalidOperation: "cannot cast fixed-size-list inner type: '{:?}' to dtype: {:?}", dt, child_type)
polars_bail!(InvalidOperation: "cannot cast Array inner type: '{:?}' to dtype: {:?}", dt, child_type)
},
_ => {
// ensure the inner logical type bubbles up
Expand Down Expand Up @@ -483,7 +483,13 @@ impl ChunkCast for ArrayChunked {
))
}
},
_ => polars_bail!(InvalidOperation: "cannot cast list type"),
_ => {
polars_bail!(
InvalidOperation: "cannot cast Array type (inner: '{:?}', to: '{:?}')",
self.inner_dtype(),
data_type,
)
},
}
}

Expand Down

0 comments on commit 4126c01

Please sign in to comment.