Skip to content

Commit 183c831

Browse files
authored
fix: Explicitly capture backtrace for ArrowError as upstream doesn't capture them (#2670)
1 parent 1ab0455 commit 183c831

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pyvortex/src/arrays/from_arrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(super) fn from_arrow(obj: &Bound<'_, PyAny>) -> PyResult<PyArrayRef> {
4848
let dtype = DType::from_arrow(array_stream.schema());
4949
let chunks = array_stream
5050
.into_iter()
51-
.map(|b| b.map_err(VortexError::ArrowError))
51+
.map(|b| b.map_err(VortexError::from))
5252
.map(|b| b.and_then(|b| b.try_into_array()))
5353
.collect::<VortexResult<Vec<_>>>()?;
5454
Ok(PyArrayRef::from(

vortex-error/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,8 @@ pub enum VortexError {
101101
#[error("{0}: {1}")]
102102
Context(ErrString, #[source] Box<VortexError>),
103103
/// A wrapper for errors from the Arrow library.
104-
#[error(transparent)]
105-
ArrowError(
106-
#[from]
107-
#[backtrace]
108-
arrow_schema::ArrowError,
109-
),
104+
#[error("{0}\nBacktrace:\n{1}")]
105+
ArrowError(arrow_schema::ArrowError, Backtrace),
110106
/// A wrapper for errors from the FlatBuffers library.
111107
#[cfg(feature = "flatbuffers")]
112108
#[error(transparent)]
@@ -402,6 +398,12 @@ macro_rules! vortex_panic {
402398
}};
403399
}
404400

401+
impl From<arrow_schema::ArrowError> for VortexError {
402+
fn from(value: arrow_schema::ArrowError) -> Self {
403+
VortexError::ArrowError(value, Backtrace::capture())
404+
}
405+
}
406+
405407
#[cfg(feature = "datafusion")]
406408
impl From<VortexError> for datafusion_common::DataFusionError {
407409
fn from(value: VortexError) -> Self {
@@ -413,7 +415,7 @@ impl From<VortexError> for datafusion_common::DataFusionError {
413415
impl From<VortexError> for datafusion_common::arrow::error::ArrowError {
414416
fn from(value: VortexError) -> Self {
415417
match value {
416-
VortexError::ArrowError(e) => e,
418+
VortexError::ArrowError(e, _) => e,
417419
_ => Self::from_external_error(Box::new(value)),
418420
}
419421
}

0 commit comments

Comments
 (0)