Encodes the provided `GenericListViewArray` to `out` with the provided `SortOptions` `rows` should contain the encoded child elements
(
data: &mut [u8],
out_offsets: &mut [usize],
rows: &Rows,
opts: SortOptions,
array: &GenericListViewArray<O>,
shift: usize,
)
| 366 | /// |
| 367 | /// `rows` should contain the encoded child elements |
| 368 | pub fn encode_list_view<O: OffsetSizeTrait>( |
| 369 | data: &mut [u8], |
| 370 | out_offsets: &mut [usize], |
| 371 | rows: &Rows, |
| 372 | opts: SortOptions, |
| 373 | array: &GenericListViewArray<O>, |
| 374 | shift: usize, |
| 375 | ) { |
| 376 | let offsets = array.value_offsets(); |
| 377 | let sizes = array.value_sizes(); |
| 378 | |
| 379 | out_offsets |
| 380 | .iter_mut() |
| 381 | .skip(1) |
| 382 | .enumerate() |
| 383 | .for_each(|(idx, offset)| { |
| 384 | let size = sizes[idx].as_usize(); |
| 385 | let range = array.is_valid(idx).then(|| { |
| 386 | // For empty lists (size=0), offset may be arbitrary and could underflow when shifted. |
| 387 | // Use 0 as start since the range is empty anyway. |
| 388 | let start = if size > 0 { |
| 389 | offsets[idx].as_usize() - shift |
| 390 | } else { |
| 391 | 0 |
| 392 | }; |
| 393 | start..start + size |
| 394 | }); |
| 395 | let out = &mut data[*offset..]; |
| 396 | *offset += encode_one(out, rows, range, opts) |
| 397 | }); |
| 398 | } |
| 399 | |
| 400 | /// Decodes a `GenericListViewArray` from `rows` with the provided `options` |
| 401 | /// |
no test coverage detected