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

Function test_builder_with_child_data

arrow-data/src/data.rs:2330–2354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2328
2329 #[test]
2330 fn test_builder_with_child_data() {
2331 let child_arr_data = ArrayData::try_new(
2332 DataType::Int32,
2333 5,
2334 None,
2335 0,
2336 vec![Buffer::from_slice_ref([1i32, 2, 3, 4, 5])],
2337 vec![],
2338 )
2339 .unwrap();
2340
2341 let field = Arc::new(Field::new("x", DataType::Int32, true));
2342 let data_type = DataType::Struct(vec![field].into());
2343
2344 let arr_data = ArrayData::builder(data_type)
2345 .len(5)
2346 .offset(0)
2347 .add_child_data(child_arr_data.clone())
2348 .build()
2349 .unwrap();
2350
2351 assert_eq!(5, arr_data.len());
2352 assert_eq!(1, arr_data.child_data().len());
2353 assert_eq!(child_arr_data, arr_data.child_data()[0]);
2354 }
2355
2356 #[test]
2357 fn test_null_count() {

Callers

nothing calls this directly

Calls 6

try_newFunction · 0.85
add_child_dataMethod · 0.80
buildMethod · 0.45
offsetMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected