Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
ArrayData -> new_unchecked
  • Loading branch information
a10y committed Aug 1, 2024
commit b16170c7d0df3e3313f9bce5c2fdf4d3dfe9b167
15 changes: 3 additions & 12 deletions arrow-select/src/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,20 +485,11 @@ fn take_byte_view<T: ByteViewType, IndexType: ArrowPrimitiveType>(
array: &GenericByteViewArray<T>,
indices: &PrimitiveArray<IndexType>,
) -> Result<GenericByteViewArray<T>, ArrowError> {
let data_len = indices.len();

let new_views = take_native(array.views(), indices);
let new_nulls = take_nulls(array.nulls(), indices);

let array_data = ArrayData::builder(T::DATA_TYPE)
.len(data_len)
.add_buffer(new_views.into_inner())
.add_buffers(array.data_buffers().to_vec())
.nulls(new_nulls);

let array_data = unsafe { array_data.build_unchecked() };

Ok(GenericByteViewArray::from(array_data))
Ok(unsafe {
GenericByteViewArray::new_unchecked(new_views, array.data_buffers().to_vec(), new_nulls)
})
}

/// `take` implementation for list arrays
Expand Down