nevi-me commented on a change in pull request #8561:
URL: https://github.com/apache/arrow/pull/8561#discussion_r516922735
##########
File path: rust/arrow/src/array/array.rs
##########
@@ -2319,13 +2221,24 @@ impl<T: ArrowPrimitiveType> From<ArrayDataRef> for
DictionaryArray<T> {
"DictionaryArray should contain a single child array (values)."
);
- let raw_values = data.buffers()[0].raw_data();
- let dtype: &DataType = data.data_type();
- let values = make_array(data.child_data()[0].clone());
- if let DataType::Dictionary(_, _) = dtype {
+ if let DataType::Dictionary(key_data_type, _) = data.data_type() {
+ if key_data_type.as_ref() != &T::DATA_TYPE {
+ panic!("DictionaryArray's data type must match.")
+ };
+ // create a zero-copy of the keys' data
+ let keys = PrimitiveArray::<T>::from(Arc::new(ArrayData::new(
+ T::DATA_TYPE,
+ data.len(),
+ Some(data.null_count()),
+ data.null_buffer().map(|b| b.clone()),
Review comment:
`cloned()` I think
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]