| 3260 | |
| 3261 | |
| 3262 | def test_array_sort_indices(): |
| 3263 | arr = pa.array([1, 2, None, 0]) |
| 3264 | result = pc.array_sort_indices(arr) |
| 3265 | assert result.to_pylist() == [3, 0, 1, 2] |
| 3266 | result = pc.array_sort_indices(arr, order="ascending") |
| 3267 | assert result.to_pylist() == [3, 0, 1, 2] |
| 3268 | result = pc.array_sort_indices(arr, order="descending") |
| 3269 | assert result.to_pylist() == [1, 0, 3, 2] |
| 3270 | result = pc.array_sort_indices(arr, order="descending", |
| 3271 | null_placement="at_start") |
| 3272 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3273 | result = pc.array_sort_indices(arr, "descending", |
| 3274 | null_placement="at_start") |
| 3275 | assert result.to_pylist() == [2, 1, 0, 3] |
| 3276 | |
| 3277 | with pytest.raises(ValueError, match="not a valid sort order"): |
| 3278 | pc.array_sort_indices(arr, order="nonscending") |
| 3279 | |
| 3280 | |
| 3281 | def test_search_sorted(): |