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

Function test_gc_all_inline

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

Source from the content-addressed store, hash-verified

1406 /// 2) All inline values (<= INLINE_LEN): capacity-only data buffer, same values
1407 #[test]
1408 fn test_gc_all_inline() {
1409 let mut builder = StringViewBuilder::new().with_fixed_block_size(BLOCK_SIZE);
1410 // append many short strings, each exactly INLINE_LEN long
1411 for _ in 0..100 {
1412 let s = "A".repeat(MAX_INLINE_VIEW_LEN as usize);
1413 builder.append_option(Some(&s));
1414 }
1415 let array = builder.finish();
1416 let gced = array.gc();
1417 // Since all views fit inline, data buffer is empty
1418 assert_eq!(
1419 gced.data_buffers().len(),
1420 0,
1421 "Should have no data buffers for inline values"
1422 );
1423 assert_eq!(gced.len(), 100);
1424 // verify element-wise equality
1425 array.iter().zip(gced.iter()).for_each(|(orig, got)| {
1426 assert_eq!(orig, got, "Inline value mismatch after gc");
1427 });
1428 }
1429
1430 /// 3) All large values (> INLINE_LEN): each must be copied into the new data buffer
1431 #[test]

Callers

nothing calls this directly

Calls 6

with_fixed_block_sizeMethod · 0.80
gcMethod · 0.80
zipMethod · 0.80
append_optionMethod · 0.45
finishMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected