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

Function test_primitive_array_builder

arrow-array/src/array/primitive_array.rs:2246–2263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2244
2245 #[test]
2246 fn test_primitive_array_builder() {
2247 // Test building a primitive array with ArrayData builder and offset
2248 let buf = Buffer::from_slice_ref([0i32, 1, 2, 3, 4, 5, 6]);
2249 let buf2 = buf.slice_with_length(8, 20);
2250 let data = ArrayData::builder(DataType::Int32)
2251 .len(5)
2252 .offset(2)
2253 .add_buffer(buf)
2254 .build()
2255 .unwrap();
2256 let arr = Int32Array::from(data);
2257 assert_eq!(&buf2, arr.values.inner());
2258 assert_eq!(5, arr.len());
2259 assert_eq!(0, arr.null_count());
2260 for i in 0..3 {
2261 assert_eq!((i + 2) as i32, arr.value(i));
2262 }
2263 }
2264
2265 #[test]
2266 fn test_primitive_from_iter_values() {

Callers

nothing calls this directly

Calls 5

slice_with_lengthMethod · 0.80
add_bufferMethod · 0.80
buildMethod · 0.45
offsetMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected