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

Function test_empty_offsets

arrow-array/src/array/list_array.rs:1235–1254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1233
1234 #[test]
1235 fn test_empty_offsets() {
1236 let f = Arc::new(Field::new("element", DataType::Int32, true));
1237 let string = ListArray::from(
1238 ArrayData::builder(DataType::List(f.clone()))
1239 .buffers(vec![Buffer::from(&[])])
1240 .add_child_data(ArrayData::new_empty(&DataType::Int32))
1241 .build()
1242 .unwrap(),
1243 );
1244 assert_eq!(string.value_offsets(), &[0]);
1245 let string = LargeListArray::from(
1246 ArrayData::builder(DataType::LargeList(f))
1247 .buffers(vec![Buffer::from(&[])])
1248 .add_child_data(ArrayData::new_empty(&DataType::Int32))
1249 .build()
1250 .unwrap(),
1251 );
1252 assert_eq!(string.len(), 0);
1253 assert_eq!(string.value_offsets(), &[0]);
1254 }
1255
1256 #[test]
1257 fn test_try_new() {

Callers

nothing calls this directly

Calls 6

LargeListClass · 0.85
add_child_dataMethod · 0.80
ListClass · 0.50
buildMethod · 0.45
buffersMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected