[Python] Fix deprecation warnings for RankOptions null_placement in our own tests
In the test logs on CI, I see:
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_option_class_equality
/opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py:175: FutureWarning: Specifying null_placement in RankOptions is deprecated as of 25.0.0. Specify null_placement per sort_key instead.
pc.RankOptions(sort_keys="ascending",
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_option_class_equality
/opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py:177: FutureWarning: Specifying null_placement in RankOptions is deprecated as of 25.0.0. Specify null_placement per sort_key instead.
pc.RankQuantileOptions(sort_keys="ascending",
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_options_tiebreaker[min-expected_values0]
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_options_tiebreaker[max-expected_values1]
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_options_tiebreaker[first-expected_values2]
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_options_tiebreaker[dense-expected_values3]
/opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py:3885: FutureWarning: Specifying null_placement in RankOptions is deprecated as of 25.0.0. Specify null_placement per sort_key instead.
rank_options = pc.RankOptions(sort_keys="ascending",
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_options
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_quantile_options
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_normal_options
/opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/compute.py:230: FutureWarning: Specifying null_placement in RankOptions is deprecated as of 25.0.0. Specify null_placement per sort_key instead.
return options_class(*args, **kwargs)
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_options
/opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py:3921: FutureWarning: Specifying null_placement in RankOptions is deprecated as of 25.0.0. Specify null_placement per sort_key instead.
pc.RankOptions(sort_keys="descending",
opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py::test_rank_normal_options
/opt/conda/envs/arrow/lib/python3.14/site-packages/pyarrow/tests/test_compute.py:3975: FutureWarning: Specifying null_placement in RankOptions is deprecated as of 25.0.0. Specify null_placement per sort_key instead.
options=pc.RankQuantileOptions(null_placement="at_start",
Those warnings should not appear in our own tests (either update the tests to use the new pattern, or explicitly assert that the warning is happening)
Caused by https://github.com/apache/arrow/pull/46926 cc @taepper
I see. Yes, this is unfortunate. We can remove the tests using the deprecated interface to avoid this warning. I left them in the PR because I thought it is still good to have test coverage for deprecated functionality.
If what is being tested in those tests is covered by new tests (using the new interface), but we want to keep them to ensure this deprecated path is still working (which is indeed a good idea), then we can just suppress the warnings with a @pytest.mark.filterwarnings("ignore:...")
Great, thanks. I am not an expert in python and only adapted the interfaces when changing the underlying c++ interfaces.
take
Issue resolved by pull request 51307 https://github.com/apache/arrow/pull/51307