alamb commented on code in PR #9158:
URL: https://github.com/apache/arrow-rs/pull/9158#discussion_r2686960431
##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -988,12 +988,18 @@ impl<'a, T: ByteViewType + ?Sized> IntoIterator for &'a
GenericByteViewArray<T>
impl<T: ByteViewType + ?Sized> From<ArrayData> for GenericByteViewArray<T> {
fn from(data: ArrayData) -> Self {
- let (_data_type, len, nulls, offset, mut buffers, _child_data) =
data.into_parts();
+ let (data_type, len, nulls, offset, mut buffers, _child_data) =
data.into_parts();
+ assert_eq!(
+ data_type,
+ T::DATA_TYPE,
+ "Mismatched data type, expected {}, got {data_type}",
+ T::DATA_TYPE
+ );
let views = buffers.remove(0); // need to maintain order of remaining
buffers
let buffers = Arc::from(buffers);
let views = ScalarBuffer::new(views, offset, len);
Self {
- data_type: T::DATA_TYPE,
+ data_type,
Review Comment:
@jhorstmann noted that reusing `data_type` here might be faster as it
avoids a call to `DataType::drop` 🤷
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]