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

Function test_run_array_eq_sliced

arrow-array/src/array/run_array.rs:1443–1465  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1441
1442 #[test]
1443 fn test_run_array_eq_sliced() {
1444 let run_ends1 = Int32Array::from(vec![2, 5, 10]);
1445 let values1 = StringArray::from(vec!["a", "b", "c"]);
1446 let array1 = RunArray::<Int32Type>::try_new(&run_ends1, &values1).unwrap();
1447 // Logical: a, a, b, b, b, c, c, c, c, c
1448
1449 let slice1 = array1.slice(1, 6);
1450 // Logical: a, b, b, b, c, c
1451
1452 let run_ends2 = Int32Array::from(vec![1, 4, 6]);
1453 let values2 = StringArray::from(vec!["a", "b", "c"]);
1454 let array2 = RunArray::<Int32Type>::try_new(&run_ends2, &values2).unwrap();
1455 // Logical: a, b, b, b, c, c
1456
1457 assert_eq!(slice1, array2);
1458
1459 let slice2 = array1.slice(2, 3);
1460 // Logical: b, b, b
1461 let run_ends3 = Int32Array::from(vec![3]);
1462 let values3 = StringArray::from(vec!["b"]);
1463 let array3 = RunArray::<Int32Type>::try_new(&run_ends3, &values3).unwrap();
1464 assert_eq!(slice2, array3);
1465 }
1466
1467 #[test]
1468 fn test_run_array_eq_sliced_different_offsets() {

Callers

nothing calls this directly

Calls 2

try_newFunction · 0.85
sliceMethod · 0.45

Tested by

no test coverage detected