@@ -128,3 +128,53 @@ def test_compare_schemas_nullability():
128128)
129129def test_scalar_to_py_smart (value : pyarrow .Scalar , expected : typing .Any ) -> None :
130130 assert compare .scalar_to_py_smart (value ) == expected
131+
132+
133+ @pytest .mark .parametrize (
134+ "table, sort_keys, expected" ,
135+ [
136+ pytest .param (
137+ pyarrow .Table .from_pylist (
138+ [
139+ {"idx" : 1 , "value" : 0 },
140+ {"idx" : 0 , "value" : 1 },
141+ {"idx" : 2 , "value" : 2 },
142+ ]
143+ ),
144+ [("idx" , "descending" )],
145+ pyarrow .Table .from_pylist (
146+ [
147+ {"idx" : 2 , "value" : 2 },
148+ {"idx" : 1 , "value" : 0 },
149+ {"idx" : 0 , "value" : 1 },
150+ ]
151+ ),
152+ id = "int" ,
153+ ),
154+ pytest .param (
155+ pyarrow .Table .from_pydict (
156+ {
157+ "idx" : pyarrow .opaque (pyarrow .int64 (), "test" , "" ).wrap_array (
158+ pyarrow .array ([1 , 0 , 2 ])
159+ ),
160+ "value" : pyarrow .array ([0 , 1 , 2 ]),
161+ }
162+ ),
163+ [("idx" , "descending" )],
164+ pyarrow .Table .from_pydict (
165+ {
166+ "idx" : pyarrow .opaque (pyarrow .int64 (), "test" , "" ).wrap_array (
167+ pyarrow .array ([2 , 1 , 0 ])
168+ ),
169+ "value" : pyarrow .array ([2 , 0 , 1 ]),
170+ }
171+ ),
172+ id = "extension" ,
173+ ),
174+ ],
175+ )
176+ def test_sort_oblivious (
177+ table : pyarrow .Table , sort_keys : list , expected : pyarrow .Table
178+ ) -> None :
179+ result = compare .sort_oblivious (table , sort_keys )
180+ assert result .equals (expected )
0 commit comments