From 10f55195d419b3e4feda93b97ba2e1c0ffe7fd32 Mon Sep 17 00:00:00 2001 From: AlenkaF Date: Wed, 1 Apr 2026 11:21:21 +0200 Subject: [PATCH 1/4] Add depr warnings to code --- python/pyarrow/gandiva.pyx | 8 ++++++++ python/pyarrow/tests/test_gandiva.py | 16 +++++----------- python/setup.cfg | 2 ++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/python/pyarrow/gandiva.pyx b/python/pyarrow/gandiva.pyx index eb764df73582..bca74310a73b 100644 --- a/python/pyarrow/gandiva.pyx +++ b/python/pyarrow/gandiva.pyx @@ -75,6 +75,14 @@ from pyarrow.includes.libgandiva cimport ( GetRegisteredFunctionSignatures) +import warnings +warnings.warn( + "pyarrow.gandiva is deprecated as of 24.0.0 and will be removed in a future version.", + FutureWarning, + stacklevel=2, + ) + + cdef class Node(_Weakrefable): cdef: shared_ptr[CNode] node diff --git a/python/pyarrow/tests/test_gandiva.py b/python/pyarrow/tests/test_gandiva.py index 80d119a48530..9e4b16874759 100644 --- a/python/pyarrow/tests/test_gandiva.py +++ b/python/pyarrow/tests/test_gandiva.py @@ -20,8 +20,12 @@ import pyarrow as pa +pytestmark = [ + pytest.mark.gandiva, + pytest.mark.filterwarnings("ignore:pyarrow.gandiva is deprecated"), + ] + -@pytest.mark.gandiva def test_tree_exp_builder(): import pyarrow.gandiva as gandiva @@ -63,7 +67,6 @@ def test_tree_exp_builder(): assert r.equals(e) -@pytest.mark.gandiva def test_table(): import pyarrow.gandiva as gandiva @@ -90,7 +93,6 @@ def test_table(): assert r.equals(e) -@pytest.mark.gandiva def test_filter(): import pyarrow.gandiva as gandiva @@ -114,7 +116,6 @@ def test_filter(): assert result.to_array().equals(pa.array(range(1000), type=pa.uint32())) -@pytest.mark.gandiva def test_in_expr(): import pyarrow.gandiva as gandiva @@ -225,7 +226,6 @@ def test_in_expr_todo(): assert list(result.to_array()) == [1] -@pytest.mark.gandiva def test_boolean(): import pyarrow.gandiva as gandiva @@ -252,7 +252,6 @@ def test_boolean(): assert result.to_array().equals(pa.array([0, 2, 5], type=pa.uint32())) -@pytest.mark.gandiva def test_literals(): import pyarrow.gandiva as gandiva @@ -292,7 +291,6 @@ def test_literals(): builder.make_literal(True, None) -@pytest.mark.gandiva def test_regex(): import pyarrow.gandiva as gandiva @@ -316,7 +314,6 @@ def test_regex(): assert r.equals(b) -@pytest.mark.gandiva def test_get_registered_function_signatures(): import pyarrow.gandiva as gandiva signatures = gandiva.get_registered_function_signatures() @@ -326,7 +323,6 @@ def test_get_registered_function_signatures(): assert hasattr(signatures[0], "name") -@pytest.mark.gandiva def test_filter_project(): import pyarrow.gandiva as gandiva mpool = pa.default_memory_pool() @@ -373,7 +369,6 @@ def test_filter_project(): assert r.equals(exp) -@pytest.mark.gandiva def test_to_string(): import pyarrow.gandiva as gandiva builder = gandiva.TreeExprBuilder() @@ -393,7 +388,6 @@ def test_to_string(): assert str(and_node) == 'bool not((bool) z) && (bool) y' -@pytest.mark.gandiva def test_rejects_none(): import pyarrow.gandiva as gandiva diff --git a/python/setup.cfg b/python/setup.cfg index b0c3edfa8bea..2d6558009b16 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -22,6 +22,8 @@ build-dir = doc/_build [tool:pytest] addopts = --ignore=scripts filterwarnings = + # https://github.com/apache/arrow/issues/49227 + ignore:pyarrow.gandiva is deprecated:FutureWarning error:The SparseDataFrame:FutureWarning # https://github.com/apache/arrow/issues/38239 ignore:Setting custom ClientSession:DeprecationWarning From be4fce1475836130a746ad54b9c86fb101898ed1 Mon Sep 17 00:00:00 2001 From: AlenkaF Date: Wed, 1 Apr 2026 11:51:05 +0200 Subject: [PATCH 2/4] Add docs changes --- docs/source/developers/python/building.rst | 2 +- docs/source/developers/python/development.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/developers/python/building.rst b/docs/source/developers/python/building.rst index 1d40d78f0abb..73a2482ecbfa 100644 --- a/docs/source/developers/python/building.rst +++ b/docs/source/developers/python/building.rst @@ -621,7 +621,7 @@ certain components to be built): * - ``ARROW_ORC`` - ``PYARROW_WITH_ORC`` * - ``ARROW_GANDIVA`` - - ``PYARROW_WITH_GANDIVA`` + - ``PYARROW_WITH_GANDIVA`` (deprecated since version 24.0.0) Installing Nightly Packages =========================== diff --git a/docs/source/developers/python/development.rst b/docs/source/developers/python/development.rst index e70fb4430757..91f98cab060b 100644 --- a/docs/source/developers/python/development.rst +++ b/docs/source/developers/python/development.rst @@ -90,7 +90,7 @@ The test groups currently include: * ``dataset``: Apache Arrow Dataset tests * ``flight``: Flight RPC tests -* ``gandiva``: tests for Gandiva expression compiler (uses LLVM) +* ``gandiva``: tests for Gandiva expression compiler (uses LLVM, deprecated since version 24.0.0) * ``hdfs``: tests that use libhdfs to access the Hadoop filesystem * ``hypothesis``: tests that use the ``hypothesis`` module for generating random test cases. Note that ``--hypothesis`` doesn't work due to a quirk From cd3c2ef38043dc2685eec93486bf5dfb50d8203e Mon Sep 17 00:00:00 2001 From: AlenkaF Date: Wed, 1 Apr 2026 11:57:34 +0200 Subject: [PATCH 3/4] Remove filterwarnings in the test due to added filterwarning in setup.ctf --- python/pyarrow/tests/test_gandiva.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/python/pyarrow/tests/test_gandiva.py b/python/pyarrow/tests/test_gandiva.py index 9e4b16874759..80d119a48530 100644 --- a/python/pyarrow/tests/test_gandiva.py +++ b/python/pyarrow/tests/test_gandiva.py @@ -20,12 +20,8 @@ import pyarrow as pa -pytestmark = [ - pytest.mark.gandiva, - pytest.mark.filterwarnings("ignore:pyarrow.gandiva is deprecated"), - ] - +@pytest.mark.gandiva def test_tree_exp_builder(): import pyarrow.gandiva as gandiva @@ -67,6 +63,7 @@ def test_tree_exp_builder(): assert r.equals(e) +@pytest.mark.gandiva def test_table(): import pyarrow.gandiva as gandiva @@ -93,6 +90,7 @@ def test_table(): assert r.equals(e) +@pytest.mark.gandiva def test_filter(): import pyarrow.gandiva as gandiva @@ -116,6 +114,7 @@ def test_filter(): assert result.to_array().equals(pa.array(range(1000), type=pa.uint32())) +@pytest.mark.gandiva def test_in_expr(): import pyarrow.gandiva as gandiva @@ -226,6 +225,7 @@ def test_in_expr_todo(): assert list(result.to_array()) == [1] +@pytest.mark.gandiva def test_boolean(): import pyarrow.gandiva as gandiva @@ -252,6 +252,7 @@ def test_boolean(): assert result.to_array().equals(pa.array([0, 2, 5], type=pa.uint32())) +@pytest.mark.gandiva def test_literals(): import pyarrow.gandiva as gandiva @@ -291,6 +292,7 @@ def test_literals(): builder.make_literal(True, None) +@pytest.mark.gandiva def test_regex(): import pyarrow.gandiva as gandiva @@ -314,6 +316,7 @@ def test_regex(): assert r.equals(b) +@pytest.mark.gandiva def test_get_registered_function_signatures(): import pyarrow.gandiva as gandiva signatures = gandiva.get_registered_function_signatures() @@ -323,6 +326,7 @@ def test_get_registered_function_signatures(): assert hasattr(signatures[0], "name") +@pytest.mark.gandiva def test_filter_project(): import pyarrow.gandiva as gandiva mpool = pa.default_memory_pool() @@ -369,6 +373,7 @@ def test_filter_project(): assert r.equals(exp) +@pytest.mark.gandiva def test_to_string(): import pyarrow.gandiva as gandiva builder = gandiva.TreeExprBuilder() @@ -388,6 +393,7 @@ def test_to_string(): assert str(and_node) == 'bool not((bool) z) && (bool) y' +@pytest.mark.gandiva def test_rejects_none(): import pyarrow.gandiva as gandiva From 430454c5d4604b0722b6023ecfdbb9b495074cd0 Mon Sep 17 00:00:00 2001 From: AlenkaF Date: Wed, 1 Apr 2026 13:06:09 +0200 Subject: [PATCH 4/4] Run linter --- python/pyarrow/gandiva.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyarrow/gandiva.pyx b/python/pyarrow/gandiva.pyx index bca74310a73b..0a6e8f786e5d 100644 --- a/python/pyarrow/gandiva.pyx +++ b/python/pyarrow/gandiva.pyx @@ -80,7 +80,7 @@ warnings.warn( "pyarrow.gandiva is deprecated as of 24.0.0 and will be removed in a future version.", FutureWarning, stacklevel=2, - ) +) cdef class Node(_Weakrefable):