Skip to content

Commit

Permalink
fix: improve errors on field cast failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jkylling authored and ion-elgreco committed Oct 13, 2024
1 parent 7a3b03f commit 0b3595c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/core/src/operations/cast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,19 @@ fn cast_field(
add_missing,
)?) as ArrayRef),
_ if is_cast_required(col_type, field_type) => {
cast_with_options(col, field_type, cast_options)
cast_with_options(col, field_type, cast_options).map_err(|err| {
if let ArrowError::CastError(err) = err {
ArrowError::CastError(format!(
"Failed to cast {} from {} to {}: {}",
field.name(),
field_type,
col_type,
err
))
} else {
err
}
})
}
_ => Ok(col.clone()),
}
Expand Down

0 comments on commit 0b3595c

Please sign in to comment.