MCPcopy Create free account
hub / github.com/apache/arrow-rs / make_large_list_array

Function make_large_list_array

arrow/tests/array_cast.rs:402–424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

400}
401
402fn make_large_list_array() -> LargeListArray {
403 // Construct a value array
404 let value_data = ArrayData::builder(DataType::Int32)
405 .len(8)
406 .add_buffer(Buffer::from_slice_ref([0, 1, 2, 3, 4, 5, 6, 7]))
407 .build()
408 .unwrap();
409
410 // Construct a buffer for value offsets, for the nested array:
411 // [[0, 1, 2], [3, 4, 5], [6, 7]]
412 let value_offsets = Buffer::from_slice_ref([0i64, 3, 6, 8]);
413
414 // Construct a list array from the above two
415 let list_data_type =
416 DataType::LargeList(Arc::new(Field::new_list_field(DataType::Int32, true)));
417 let list_data = ArrayData::builder(list_data_type)
418 .len(3)
419 .add_buffer(value_offsets)
420 .add_child_data(value_data)
421 .build()
422 .unwrap();
423 LargeListArray::from(list_data)
424}
425
426fn make_union_array() -> UnionArray {
427 let mut builder = UnionBuilder::with_capacity_dense(7);

Callers

nothing calls this directly

Calls 5

LargeListClass · 0.85
add_bufferMethod · 0.80
add_child_dataMethod · 0.80
buildMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected