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

Function test_builder

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

Source from the content-addressed store, hash-verified

2303
2304 #[test]
2305 fn test_builder() {
2306 // Buffer needs to be at least 25 long
2307 let v = (0..25).collect::<Vec<i32>>();
2308 let b1 = Buffer::from_slice_ref(&v);
2309 let arr_data = ArrayData::builder(DataType::Int32)
2310 .len(20)
2311 .offset(5)
2312 .add_buffer(b1)
2313 .null_bit_buffer(Some(Buffer::from([
2314 0b01011111, 0b10110101, 0b01100011, 0b00011110,
2315 ])))
2316 .build()
2317 .unwrap();
2318
2319 assert_eq!(20, arr_data.len());
2320 assert_eq!(10, arr_data.null_count());
2321 assert_eq!(5, arr_data.offset());
2322 assert_eq!(1, arr_data.buffers().len());
2323 assert_eq!(
2324 Buffer::from_slice_ref(&v).as_slice(),
2325 arr_data.buffers()[0].as_slice()
2326 );
2327 }
2328
2329 #[test]
2330 fn test_builder_with_child_data() {

Callers

nothing calls this directly

Calls 5

add_bufferMethod · 0.80
buildMethod · 0.45
null_bit_bufferMethod · 0.45
offsetMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected