alamb commented on code in PR #9185:
URL: https://github.com/apache/arrow-rs/pull/9185#discussion_r2694372336
##########
arrow-array/src/array/dictionary_array.rs:
##########
@@ -603,19 +607,10 @@ impl<T: ArrowDictionaryKeyType> From<ArrayData> for
DictionaryArray<T> {
key_data_type
);
- let values = make_array(data.child_data()[0].clone());
- let data_type = data.data_type().clone();
+ let values = make_array(cd);
// create a zero-copy of the keys' data
- // SAFETY:
- // ArrayData is valid and verified type above
-
- let keys = PrimitiveArray::<T>::from(unsafe {
- data.into_builder()
- .data_type(T::DATA_TYPE)
- .child_data(vec![])
- .build_unchecked()
- });
+ let keys = PrimitiveArray::<T>::new(ScalarBuffer::new(buffer,
offset, len), nulls);
Review Comment:
Bonus removal of unsafe
--
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]