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 committed Oct 8, 2024
1 parent ef4e4a3 commit a84a6b0
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 a84a6b0

Please sign in to comment.