Helper function that creates an [`OffsetBuffer`] from a buffer and array offset/ length # Safety - buffer must contain valid arrow offsets ( [`OffsetBuffer`] ) for the given length and offset.
(
buffer: Buffer,
offset: usize,
len: usize,
)
| 1028 | /// - buffer must contain valid arrow offsets ( [`OffsetBuffer`] ) for the |
| 1029 | /// given length and offset. |
| 1030 | unsafe fn get_offsets_from_buffer<O: ArrowNativeType>( |
| 1031 | buffer: Buffer, |
| 1032 | offset: usize, |
| 1033 | len: usize, |
| 1034 | ) -> OffsetBuffer<O> { |
| 1035 | if len == 0 && buffer.is_empty() { |
| 1036 | return OffsetBuffer::new_empty(); |
| 1037 | } |
| 1038 | |
| 1039 | let scalar_buffer = ScalarBuffer::new(buffer, offset, len + 1); |
| 1040 | // Safety: |
| 1041 | // Arguments were valid |
| 1042 | unsafe { OffsetBuffer::new_unchecked(scalar_buffer) } |
| 1043 | } |
| 1044 | |
| 1045 | /// Helper function for printing potentially long arrays. |
| 1046 | fn print_long_array<A, F>(array: &A, f: &mut std::fmt::Formatter, print_item: F) -> std::fmt::Result |
no test coverage detected