()
| 377 | } |
| 378 | |
| 379 | fn make_list_array() -> ListArray { |
| 380 | // Construct a value array |
| 381 | let value_data = ArrayData::builder(DataType::Int32) |
| 382 | .len(8) |
| 383 | .add_buffer(Buffer::from_slice_ref([0, 1, 2, 3, 4, 5, 6, 7])) |
| 384 | .build() |
| 385 | .unwrap(); |
| 386 | |
| 387 | // Construct a buffer for value offsets, for the nested array: |
| 388 | // [[0, 1, 2], [3, 4, 5], [6, 7]] |
| 389 | let value_offsets = Buffer::from_slice_ref([0, 3, 6, 8]); |
| 390 | |
| 391 | // Construct a list array from the above two |
| 392 | let list_data_type = DataType::List(Arc::new(Field::new_list_field(DataType::Int32, true))); |
| 393 | let list_data = ArrayData::builder(list_data_type) |
| 394 | .len(3) |
| 395 | .add_buffer(value_offsets) |
| 396 | .add_child_data(value_data) |
| 397 | .build() |
| 398 | .unwrap(); |
| 399 | ListArray::from(list_data) |
| 400 | } |
| 401 | |
| 402 | fn make_large_list_array() -> LargeListArray { |
| 403 | // Construct a value array |
nothing calls this directly
no test coverage detected