| 1683 | // Test the simple case of concatenating two RunArrays |
| 1684 | #[test] |
| 1685 | fn test_concat_run_array() { |
| 1686 | // Create simple run arrays |
| 1687 | let run_ends1 = Int32Array::from(vec![2, 4]); |
| 1688 | let values1 = Int32Array::from(vec![10, 20]); |
| 1689 | let array1 = RunArray::try_new(&run_ends1, &values1).unwrap(); |
| 1690 | |
| 1691 | let run_ends2 = Int32Array::from(vec![1, 4]); |
| 1692 | let values2 = Int32Array::from(vec![30, 40]); |
| 1693 | let array2 = RunArray::try_new(&run_ends2, &values2).unwrap(); |
| 1694 | |
| 1695 | // Concatenate the arrays - this should now work properly |
| 1696 | let result = concat(&[&array1, &array2]).unwrap(); |
| 1697 | let result_run_array: &arrow_array::RunArray<Int32Type> = result.as_run(); |
| 1698 | |
| 1699 | // Check that the result has the correct length |
| 1700 | assert_eq!(result_run_array.len(), 8); // 4 + 4 |
| 1701 | |
| 1702 | // Check the run ends |
| 1703 | let run_ends = result_run_array.run_ends().values(); |
| 1704 | assert_eq!(run_ends.len(), 4); |
| 1705 | assert_eq!(&[2, 4, 5, 8], run_ends); |
| 1706 | |
| 1707 | // Check the values |
| 1708 | let values = result_run_array |
| 1709 | .values() |
| 1710 | .as_any() |
| 1711 | .downcast_ref::<Int32Array>() |
| 1712 | .unwrap(); |
| 1713 | assert_eq!(values.len(), 4); |
| 1714 | assert_eq!(&[10, 20, 30, 40], values.values()); |
| 1715 | } |
| 1716 | |
| 1717 | #[test] |
| 1718 | fn test_concat_sliced_run_array() { |