Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions arrow-array/src/array/fixed_size_list_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,10 @@ impl FixedSizeListArray {

impl From<ArrayData> for FixedSizeListArray {
fn from(data: ArrayData) -> Self {
let value_length = match data.data_type() {
DataType::FixedSizeList(_, len) => *len,
let (data_type, len, nulls, offset, _buffers, child_data) = data.into_parts();

let value_length = match data_type {
DataType::FixedSizeList(_, len) => len,
data_type => {
panic!(
"FixedSizeListArray data should contain a FixedSizeList data type, got {data_type}"
Expand All @@ -439,14 +441,13 @@ impl From<ArrayData> for FixedSizeListArray {
};

let size = value_length as usize;
let values =
make_array(data.child_data()[0].slice(data.offset() * size, data.len() * size));
let values = make_array(child_data[0].slice(offset * size, len * size));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still bothers me -- slice() allocates a bunch of new children ArrayDatas when I think it could mutate them in place. I'll see what I can do as a follow on PR

Self {
data_type: data.data_type().clone(),
data_type,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this avoids a DataType::drop and a clone of a NullBuffer -- I don't expect this to be a huge deal performance wise but I am trying to make all the From impls consistent

values,
nulls: data.nulls().cloned(),
nulls,
value_length,
len: data.len(),
len,
}
}
}
Expand Down
Loading