MCPcopy Create free account
hub / github.com/apache/arrow / test_array_sort

Function test_array_sort

python/pyarrow/tests/test_array.py:4110–4123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4108
4109
4110def test_array_sort():
4111 arr = pa.array([5, 7, 35], type=pa.int64())
4112 sorted_arr = arr.sort("descending")
4113 assert sorted_arr.to_pylist() == [35, 7, 5]
4114
4115 arr = pa.chunked_array([[1, 2, 3], [4, 5, 6]])
4116 sorted_arr = arr.sort("descending")
4117 assert sorted_arr.to_pylist() == [6, 5, 4, 3, 2, 1]
4118
4119 arr = pa.array([5, 7, 35, None], type=pa.int64())
4120 sorted_arr = arr.sort("descending", null_placement="at_end")
4121 assert sorted_arr.to_pylist() == [35, 7, 5, None]
4122 sorted_arr = arr.sort("descending", null_placement="at_start")
4123 assert sorted_arr.to_pylist() == [None, 35, 7, 5]
4124
4125
4126def test_struct_array_sort():

Callers

nothing calls this directly

Calls 2

chunked_arrayMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected