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

Function test_concat_run_array_single

arrow-select/src/concat.rs:1816–1843  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1814
1815 #[test]
1816 fn test_concat_run_array_single() {
1817 // Create a run array with run ends [2, 4] and values [10, 20]
1818 let run_ends1 = Int32Array::from(vec![2, 4]);
1819 let values1 = Int32Array::from(vec![10, 20]);
1820 let array1 = RunArray::try_new(&run_ends1, &values1).unwrap();
1821
1822 // Concatenate the single array
1823 let result = concat(&[&array1]).unwrap();
1824 let result_run_array: &arrow_array::RunArray<Int32Type> = result.as_run();
1825
1826 // The result should have length 4
1827 assert_eq!(result_run_array.len(), 4);
1828
1829 // Check that the run ends are correct
1830 let run_ends = result_run_array.run_ends().values();
1831 assert_eq!(&[2, 4], run_ends);
1832
1833 // Check that the values are correct
1834 assert_eq!(
1835 &[10, 20],
1836 result_run_array
1837 .values()
1838 .as_any()
1839 .downcast_ref::<Int32Array>()
1840 .unwrap()
1841 .values()
1842 );
1843 }
1844
1845 #[test]
1846 fn test_concat_run_array_with_3_arrays() {

Callers

nothing calls this directly

Calls 5

try_newFunction · 0.85
concatFunction · 0.85
as_runMethod · 0.80
run_endsMethod · 0.80
valuesMethod · 0.45

Tested by

no test coverage detected