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

Function test_gc

arrow-array/src/array/byte_view_array.rs:1355–1387  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1353
1354 #[test]
1355 fn test_gc() {
1356 let test_data = [
1357 Some("longer than 12 bytes"),
1358 Some("short"),
1359 Some("t"),
1360 Some("longer than 12 bytes"),
1361 None,
1362 Some("short"),
1363 ];
1364
1365 let array = {
1366 let mut builder = StringViewBuilder::new().with_fixed_block_size(8); // create multiple buffers
1367 test_data.into_iter().for_each(|v| builder.append_option(v));
1368 builder.finish()
1369 };
1370 assert!(array.buffers.len() > 1);
1371
1372 fn check_gc(to_test: &StringViewArray) {
1373 let gc = to_test.gc();
1374 assert_ne!(to_test.data_buffers().len(), gc.data_buffers().len());
1375
1376 to_test.iter().zip(gc.iter()).for_each(|(a, b)| {
1377 assert_eq!(a, b);
1378 });
1379 assert_eq!(to_test.len(), gc.len());
1380 }
1381
1382 check_gc(&array);
1383 check_gc(&array.slice(1, 3));
1384 check_gc(&array.slice(2, 1));
1385 check_gc(&array.slice(2, 2));
1386 check_gc(&array.slice(3, 1));
1387 }
1388
1389 /// 1) Empty array: no elements, expect gc to return empty with no data buffers
1390 #[test]

Callers

nothing calls this directly

Calls 6

check_gcFunction · 0.85
with_fixed_block_sizeMethod · 0.80
into_iterMethod · 0.45
append_optionMethod · 0.45
finishMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected