(
values: &[&dyn Array],
indices: &[(usize, usize)],
)
| 214 | } |
| 215 | |
| 216 | fn interleave_bytes<T: ByteArrayType>( |
| 217 | values: &[&dyn Array], |
| 218 | indices: &[(usize, usize)], |
| 219 | ) -> Result<ArrayRef, ArrowError> { |
| 220 | let interleaved = Interleave::<'_, GenericByteArray<T>>::new(values, indices); |
| 221 | |
| 222 | let mut capacity = 0; |
| 223 | let mut offsets = Vec::with_capacity(indices.len() + 1); |
| 224 | offsets.push(T::Offset::from_usize(0).unwrap()); |
| 225 | for (a, b) in indices { |
| 226 | let o = interleaved.arrays[*a].value_offsets(); |
| 227 | let element_len = o[*b + 1].as_usize() - o[*b].as_usize(); |
| 228 | capacity += element_len; |
| 229 | offsets.push( |
| 230 | T::Offset::from_usize(capacity) |
| 231 | .ok_or_else(|| ArrowError::OffsetOverflowError(capacity))?, |
| 232 | ); |
| 233 | } |
| 234 | |
| 235 | let mut values = Vec::with_capacity(capacity); |
| 236 | for (a, b) in indices { |
| 237 | values.extend_from_slice(interleaved.arrays[*a].value(*b).as_ref()); |
| 238 | } |
| 239 | |
| 240 | // Safety: safe by construction |
| 241 | let array = unsafe { |
| 242 | let offsets = OffsetBuffer::new_unchecked(offsets.into()); |
| 243 | GenericByteArray::<T>::new_unchecked(offsets, values.into(), interleaved.nulls) |
| 244 | }; |
| 245 | Ok(Arc::new(array)) |
| 246 | } |
| 247 | |
| 248 | fn interleave_dictionaries<K: ArrowDictionaryKeyType>( |
| 249 | arrays: &[&dyn Array], |
nothing calls this directly
no test coverage detected