This is an automated email from the ASF dual-hosted git repository.

AlenkaF pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0fea33b5d23 GH-51300: Fix deprecation warnings for `null_placement` 
(#51307)
0fea33b5d23 is described below

commit 0fea33b5d2337296f742f5bc5733089560412f90
Author: Alexander Taepper <[email protected]>
AuthorDate: Tue Sep 22 10:32:25 2026 +0200

    GH-51300: Fix deprecation warnings for `null_placement` (#51307)
    
    ### Rationale for this change
    
    Resolves #51300, which mentioned that deprecation warnings were being 
printed when executing the python tests.
    
    ### What changes are included in this PR?
    
    This migrates the test suite to use the non-deprecated api for 
`null_placement`
    
    ### Are these changes tested?
    
    Yes, python compute tests are still passing
    
    ### Are there any user-facing changes?
    
    No.
    
    Authored-by: Alexander Taepper <[email protected]>
    Signed-off-by: AlenkaF <[email protected]>
---
 python/pyarrow/tests/test_compute.py | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/python/pyarrow/tests/test_compute.py 
b/python/pyarrow/tests/test_compute.py
index 83e36a7a6d6..797fbc220ec 100644
--- a/python/pyarrow/tests/test_compute.py
+++ b/python/pyarrow/tests/test_compute.py
@@ -172,10 +172,9 @@ def test_option_class_equality(request):
         pc.PivotWiderOptions(["height"], unexpected_key_behavior="raise"),
         pc.QuantileOptions(),
         pc.RandomOptions(),
-        pc.RankOptions(sort_keys="ascending",
-                       null_placement="at_end", tiebreaker="max"),
-        pc.RankQuantileOptions(sort_keys="ascending",
-                               null_placement="at_end"),
+        pc.RankOptions(sort_keys=[("", "ascending", "at_end")],
+                       tiebreaker="max"),
+        pc.RankQuantileOptions(sort_keys=[("", "ascending", "at_end")]),
         pc.ReplaceSliceOptions(0, 1, "a"),
         pc.ReplaceSubstringOptions("a", "b"),
         pc.RoundOptions(2, "towards_infinity"),
@@ -3972,8 +3971,7 @@ def test_random():
 )
 def test_rank_options_tiebreaker(tiebreaker, expected_values):
     arr = pa.array([1.2, 0.0, 5.3, None, 5.3, None, 0.0])
-    rank_options = pc.RankOptions(sort_keys="ascending",
-                                  null_placement="at_end",
+    rank_options = pc.RankOptions(sort_keys=[("", "ascending", "at_end")],
                                   tiebreaker=tiebreaker)
     result = pc.rank(arr, options=rank_options)
     expected = pa.array(expected_values, type=pa.uint64())
@@ -3998,7 +3996,7 @@ def test_rank_options():
     )
     assert result.equals(expected)
 
-    result = pc.rank(arr, null_placement="at_start")
+    result = pc.rank(arr, sort_keys=[("", "ascending", "at_start")])
     expected_at_start = pa.array([5, 3, 6, 1, 7, 2, 4], type=pa.uint64())
     assert result.equals(expected_at_start)
 
@@ -4008,8 +4006,7 @@ def test_rank_options():
 
     with pytest.raises(ValueError,
                        match=r'"NonExisting" is not a valid tiebreaker'):
-        pc.RankOptions(sort_keys="descending",
-                       null_placement="at_end",
+        pc.RankOptions(sort_keys=[("", "descending", "at_end")],
                        tiebreaker="NonExisting")
 
 
@@ -4031,7 +4028,7 @@ def test_rank_quantile_options():
     )
     assert result.equals(expected)
 
-    result = pc.rank_quantile(arr, null_placement="at_start")
+    result = pc.rank_quantile(arr, sort_keys=[("", "ascending", "at_start")])
     expected_at_start = pa.array([0.3, 0.7, 0.3, 0.9, 0.3], type=pa.float64())
     assert result.equals(expected_at_start)
 
@@ -4051,7 +4048,7 @@ def test_rank_normal_options():
          -0.5244005127080409, 0.5244005127080407])
     result = pc.rank_normal(arr)
     assert result.to_pylist() == expected
-    result = pc.rank_normal(arr, null_placement="at_end", 
sort_keys="ascending")
+    result = pc.rank_normal(arr, sort_keys=[("", "ascending", "at_end")])
     assert result.to_pylist() == expected
     result = pc.rank_normal(arr, options=pc.RankQuantileOptions())
     assert result.to_pylist() == expected
@@ -4059,11 +4056,12 @@ def test_rank_normal_options():
     expected = pytest.approx(
         [-0.5244005127080409, 1.2815515655446004, -0.5244005127080409,
          0.5244005127080407, -0.5244005127080409])
-    result = pc.rank_normal(arr, null_placement="at_start", 
sort_keys="descending")
+    result = pc.rank_normal(arr, sort_keys=[("", "descending", "at_start")])
     assert result.to_pylist() == expected
     result = pc.rank_normal(arr,
-                            
options=pc.RankQuantileOptions(null_placement="at_start",
-                                                           
sort_keys="descending"))
+                            options=pc.RankQuantileOptions(
+                                sort_keys=[("", "descending", "at_start")])
+                            )
     assert result.to_pylist() == expected
 
 

Reply via email to