Skip to content

Commit 1b06d78

Browse files
authored
Propagate error instead of panic for take_bytes (#5395)
* Propagate Error instead of panic * Improve error message
1 parent c9029c5 commit 1b06d78

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arrow-select/src/take.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,11 @@ fn take_bytes<T: ByteArrayType, IndexType: ArrowPrimitiveType>(
420420
nulls = Some(null_buf.into())
421421
}
422422

423-
T::Offset::from_usize(values.len()).expect("offset overflow");
423+
T::Offset::from_usize(values.len()).ok_or(ArrowError::ComputeError(format!(
424+
"Offset overflow for {}BinaryArray: {}",
425+
T::Offset::PREFIX,
426+
values.len()
427+
)))?;
424428

425429
let array_data = ArrayData::builder(T::DATA_TYPE)
426430
.len(data_len)

0 commit comments

Comments
 (0)