From 3ce5b8a6a4deafbbad7a3a650db3c90cf1034d72 Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Tue, 13 Oct 2026 11:53:00 +0100 Subject: [PATCH 1/3] GH-49153: [Python] Remove APIs deprecated before 15.0.0 Remove Python APIs whose deprecation period has long expired: Schema.field_by_name, Schema.add_metadata, ChunkedArray.data, ChunkedArray.format, UnionArray.child, Table.from_arrays(names=Schema), concat_tables(promote=), CumulativeSumOptions, Flight write_table(chunksize=), FlightClient.connect, FlightServer.run, orc.write_table swapped arguments, parquet._filters_to_expression, and the FutureWarning for pandas Categorical conversion with a mismatched value_type, which now raises. --- docs/source/python/api/compute.rst | 1 - python/pyarrow/_compute.pyx | 22 --------------- python/pyarrow/_flight.pyx | 39 +------------------------- python/pyarrow/array.pxi | 42 ++-------------------------- python/pyarrow/compute.py | 1 - python/pyarrow/orc.py | 9 ------ python/pyarrow/parquet/core.py | 8 +----- python/pyarrow/table.pxi | 41 --------------------------- python/pyarrow/tests/test_array.py | 6 ---- python/pyarrow/tests/test_compute.py | 10 +------ python/pyarrow/tests/test_orc.py | 37 ++---------------------- python/pyarrow/tests/test_pandas.py | 7 +++++ python/pyarrow/tests/test_schema.py | 8 ++---- python/pyarrow/tests/test_table.py | 22 ++++----------- python/pyarrow/types.pxi | 42 ---------------------------- 15 files changed, 23 insertions(+), 272 deletions(-) diff --git a/docs/source/python/api/compute.rst b/docs/source/python/api/compute.rst index 2c4da3abd186..ab9ef655b799 100644 --- a/docs/source/python/api/compute.rst +++ b/docs/source/python/api/compute.rst @@ -603,7 +603,6 @@ Compute Options CastOptions CountOptions CumulativeOptions - CumulativeSumOptions DayOfWeekOptions DictionaryEncodeOptions ElementWiseAggregateOptions diff --git a/python/pyarrow/_compute.pyx b/python/pyarrow/_compute.pyx index 1c0c779f6037..8211c74ca39c 100644 --- a/python/pyarrow/_compute.pyx +++ b/python/pyarrow/_compute.pyx @@ -29,7 +29,6 @@ from pyarrow.lib cimport * from pyarrow.includes.common cimport * from pyarrow.includes.libarrow cimport * import pyarrow.lib as lib -from pyarrow.util import _DEPR_MSG from libcpp cimport bool as c_bool import inspect @@ -2173,27 +2172,6 @@ class CumulativeOptions(_CumulativeOptions): self._set_options(start, skip_nulls) -class CumulativeSumOptions(_CumulativeOptions): - """ - Options for `cumulative_sum` function. - - Parameters - ---------- - start : Scalar, default None - Starting value for sum computation - skip_nulls : bool, default False - When false, the first encountered null is propagated. - """ - - def __init__(self, start=None, *, skip_nulls=False): - warnings.warn( - _DEPR_MSG.format("CumulativeSumOptions", "14.0", "CumulativeOptions"), - FutureWarning, - stacklevel=2 - ) - self._set_options(start, skip_nulls) - - cdef class _PairwiseOptions(FunctionOptions): def _set_options(self, period): self.wrapped.reset(new CPairwiseOptions(period)) diff --git a/python/pyarrow/_flight.pyx b/python/pyarrow/_flight.pyx index f8118fbf61c3..2ab0ab618aec 100644 --- a/python/pyarrow/_flight.pyx +++ b/python/pyarrow/_flight.pyx @@ -21,7 +21,6 @@ import collections import enum import re import time -import warnings import weakref from cython.operator cimport dereference as deref @@ -1231,7 +1230,7 @@ cdef class MetadataRecordBatchWriter(_CRecordBatchWriter): check_flight_status( self._writer().WriteRecordBatch(deref(batch.batch), custom_metadata)) - def write_table(self, Table table, max_chunksize=None, **kwargs): + def write_table(self, Table table, max_chunksize=None): """ Write Table to stream in (contiguous) RecordBatch objects. @@ -1246,13 +1245,6 @@ cdef class MetadataRecordBatchWriter(_CRecordBatchWriter): # max_chunksize must be > 0 to have any impact int64_t c_max_chunksize = -1 - if 'chunksize' in kwargs: - max_chunksize = kwargs['chunksize'] - msg = ('The parameter chunksize is deprecated for the write_table ' - 'methods as of 0.15, please use parameter ' - 'max_chunksize instead') - warnings.warn(msg, FutureWarning) - if max_chunksize is not None: c_max_chunksize = max_chunksize @@ -1523,25 +1515,6 @@ cdef class FlightClient(_Weakrefable): else: break - @classmethod - def connect(cls, location, tls_root_certs=None, cert_chain=None, - private_key=None, override_hostname=None, - disable_server_verification=None): - """Connect to a Flight server. - - .. deprecated:: 0.15.0 - Use the ``FlightClient`` constructor or ``pyarrow.flight.connect`` function instead. - """ - warnings.warn("The 'FlightClient.connect' method is deprecated, use " - "FlightClient constructor or pyarrow.flight.connect " - "function instead") - return FlightClient( - location, tls_root_certs=tls_root_certs, - cert_chain=cert_chain, private_key=private_key, - override_hostname=override_hostname, - disable_server_verification=disable_server_verification - ) - def authenticate(self, auth_handler, options: FlightCallOptions = None): """Authenticate to the server. @@ -3205,16 +3178,6 @@ cdef class FlightServerBase(_Weakrefable): with nogil: check_flight_status(self.server.get().ServeWithSignals()) - def run(self): - """Block until the server shuts down. - - .. deprecated:: 0.15.0 - Use the ``FlightServer.serve`` method instead - """ - warnings.warn("The 'FlightServer.run' method is deprecated, use " - "FlightServer.serve method instead") - self.serve() - def shutdown(self): """Shut down the server, blocking until current requests finish. diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index bf9a6d672280..afe7a18c528c 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -377,27 +377,9 @@ def array(object obj, type=None, mask=None, size=None, from_pandas=None, indices = _codes_to_indices( values.codes, mask, index_type, memory_pool) - try: - dictionary = array( - values.categories, type=value_type, - from_pandas=True, memory_pool=memory_pool) - except TypeError: - # TODO when removing the deprecation warning, this whole - # try/except can be removed (to bubble the TypeError of - # the first array(..) call) - if value_type is not None: - warnings.warn( - "The dtype of the 'categories' of the passed " - f"categorical values ({values.categories.dtype}) does not match the " - f"specified type ({value_type}). For now ignoring the specified " - "type, but in the future this mismatch will raise a " - "TypeError", - FutureWarning, stacklevel=2) - dictionary = array( - values.categories, from_pandas=True, - memory_pool=memory_pool) - else: - raise + dictionary = array( + values.categories, type=value_type, + from_pandas=True, memory_pool=memory_pool) return DictionaryArray.from_arrays( indices, dictionary, ordered=values.ordered, safe=safe) @@ -4041,24 +4023,6 @@ cdef class UnionArray(Array): Concrete class for Arrow arrays of a Union data type. """ - def child(self, int pos): - """ - DEPRECATED, use field() instead. - - Parameters - ---------- - pos : int - The physical index of the union child field (not its type code). - - Returns - ------- - field : pyarrow.Field - The given child field. - """ - import warnings - warnings.warn("child is deprecated, use field", FutureWarning) - return self.field(pos) - def field(self, int pos): """ Return the given child field as an individual array. diff --git a/python/pyarrow/compute.py b/python/pyarrow/compute.py index d34eccdedbd5..09de66c901b3 100644 --- a/python/pyarrow/compute.py +++ b/python/pyarrow/compute.py @@ -34,7 +34,6 @@ CastOptions, CountOptions, CumulativeOptions, - CumulativeSumOptions, DayOfWeekOptions, DictionaryEncodeOptions, RunEndEncodeOptions, diff --git a/python/pyarrow/orc.py b/python/pyarrow/orc.py index 8da0a2de797e..aad47432cf0f 100644 --- a/python/pyarrow/orc.py +++ b/python/pyarrow/orc.py @@ -17,9 +17,7 @@ from numbers import Integral -import warnings -from pyarrow.lib import Table import pyarrow._orc as _orc from pyarrow.fs import _resolve_filesystem_and_path @@ -345,13 +343,6 @@ def write_table(table, where, *, dictionary_key_size_threshold=0.0, bloom_filter_columns=None, bloom_filter_fpp=0.05): - if isinstance(where, Table): - warnings.warn( - "The order of the arguments has changed. Pass as " - "'write_table(table, where)' instead. The old order will raise " - "an error in the future.", FutureWarning, stacklevel=2 - ) - table, where = where, table with ORCWriter( where, file_version=file_version, diff --git a/python/pyarrow/parquet/core.py b/python/pyarrow/parquet/core.py index 4de88fe22997..c994dd3b51cc 100644 --- a/python/pyarrow/parquet/core.py +++ b/python/pyarrow/parquet/core.py @@ -46,7 +46,7 @@ SortingColumn) from pyarrow.fs import (LocalFileSystem, FileType, _resolve_filesystem_and_path, _ensure_filesystem) -from pyarrow.util import guid, _is_path_like, _stringify_path, _deprecate_api +from pyarrow.util import guid, _is_path_like, _stringify_path def _check_contains_null(val): @@ -196,11 +196,6 @@ def convert_single_predicate(col, op, val): return reduce(operator.or_, disjunction_members) -_filters_to_expression = _deprecate_api( - "_filters_to_expression", "filters_to_expression", - filters_to_expression, "10.0.0", DeprecationWarning) - - # ---------------------------------------------------------------------- # Reading a single Parquet file @@ -2526,6 +2521,5 @@ def read_schema(where, memory_map=False, decryption_properties=None, "write_metadata", "write_table", "write_to_dataset", - "_filters_to_expression", "filters_to_expression", ) diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 2ac55a29202e..e987b59a8106 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -74,14 +74,6 @@ cdef class ChunkedArray(_PandasConvertible): self._assert_cpu() return chunked_array, (self.chunks, self.type) - @property - def data(self): - import warnings - warnings.warn("Calling .data on ChunkedArray is provided for " - "compatibility after Column was removed, simply drop " - "this attribute", FutureWarning) - return self - @property def type(self): """ @@ -167,23 +159,6 @@ cdef class ChunkedArray(_PandasConvertible): return frombytes(result, safe=True) - def format(self, **kwargs): - """ - DEPRECATED, use pyarrow.ChunkedArray.to_string - - Parameters - ---------- - **kwargs : dict - - Returns - ------- - str - """ - import warnings - warnings.warn('ChunkedArray.format is deprecated, ' - 'use ChunkedArray.to_string') - return self.to_string(**kwargs) - def __str__(self): return self.to_string() @@ -3528,14 +3503,6 @@ cdef class RecordBatch(_Tabular): else: num_rows = 0 - if isinstance(names, Schema): - import warnings - warnings.warn("Schema passed to names= option, please " - "pass schema= explicitly. " - "Will raise exception in future", FutureWarning) - schema = names - names = None - converted_arrays = _sanitize_arrays(arrays, names, schema, metadata, &c_schema) @@ -6306,7 +6273,6 @@ def concat_tables(tables, MemoryPool memory_pool=None, str promote_options="none For memory allocations, if required, otherwise use default pool. promote_options : str, default none Accepts strings "none", "default" and "permissive". - **kwargs : dict, optional Examples -------- @@ -6336,13 +6302,6 @@ def concat_tables(tables, MemoryPool memory_pool=None, str promote_options="none CConcatenateTablesOptions options = ( CConcatenateTablesOptions.Defaults()) - if "promote" in kwargs: - warnings.warn( - "promote has been superseded by promote_options='default'.", - FutureWarning, stacklevel=2) - if kwargs['promote'] is True: - promote_options = "default" - for table in tables: c_tables.push_back(table.sp_table) diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 74ff837e16e8..63c0eb0bea4e 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -1808,12 +1808,6 @@ def test_cast_chunked_array_empty(): assert result.equals(expected) -def test_chunked_array_data_warns(): - with pytest.warns(FutureWarning): - res = pa.chunked_array([[]]).data - assert isinstance(res, pa.ChunkedArray) - - @pytest.mark.numpy def test_cast_integers_unsafe(): # We let NumPy do the unsafe casting. diff --git a/python/pyarrow/tests/test_compute.py b/python/pyarrow/tests/test_compute.py index d4d44e9347e0..a8c2112d5e50 100644 --- a/python/pyarrow/tests/test_compute.py +++ b/python/pyarrow/tests/test_compute.py @@ -137,9 +137,6 @@ def test_exported_option_classes(): param.VAR_KEYWORD) -@pytest.mark.filterwarnings( - "ignore:pyarrow.CumulativeSumOptions is deprecated as of 14.0" -) def test_option_class_equality(request): options = [ pc.ArraySortOptions(), @@ -226,12 +223,7 @@ def test_option_class_equality(request): buf = option.serialize() deserialized = pc.FunctionOptions.deserialize(buf) assert option == deserialized - # TODO remove the check under the if statement and the filterwarnings - # mark when the deprecated class CumulativeSumOptions is removed. - if repr(option).startswith("CumulativeSumOptions"): - assert repr(deserialized).startswith("CumulativeOptions") - else: - assert repr(option) == repr(deserialized) + assert repr(option) == repr(deserialized) for option1, option2 in zip(options, options[1:]): assert option1 != option2 diff --git a/python/pyarrow/tests/test_orc.py b/python/pyarrow/tests/test_orc.py index 27154a6f34f3..b5b38006e5a7 100644 --- a/python/pyarrow/tests/test_orc.py +++ b/python/pyarrow/tests/test_orc.py @@ -311,19 +311,9 @@ def test_buffer_readwrite(): assert orc_file.row_index_stride == 10000 assert orc_file.compression_size == 65536 - # deprecated keyword order - buffer_output_stream = pa.BufferOutputStream() - with pytest.warns(FutureWarning): - orc.write_table(buffer_output_stream, table) - buffer_reader = pa.BufferReader(buffer_output_stream.getvalue()) - orc_file = orc.ORCFile(buffer_reader) - output_table = orc_file.read() - assert table.equals(output_table) - # Check for default WriteOptions - assert orc_file.compression == 'UNCOMPRESSED' - assert orc_file.file_version == '0.12' - assert orc_file.row_index_stride == 10000 - assert orc_file.compression_size == 65536 + # swapped argument order is no longer accepted + with pytest.raises(TypeError): + orc.write_table(pa.BufferOutputStream(), table) @pytest.mark.snappy @@ -352,27 +342,6 @@ def test_buffer_readwrite_with_writeoptions(): assert orc_file.row_index_stride == 5000 assert orc_file.compression_size == 65536 - # deprecated keyword order - buffer_output_stream = pa.BufferOutputStream() - with pytest.warns(FutureWarning): - orc.write_table( - buffer_output_stream, - table, - compression='uncompressed', - file_version='0.11', - row_index_stride=20000, - compression_block_size=65536, - ) - buffer_reader = pa.BufferReader(buffer_output_stream.getvalue()) - orc_file = orc.ORCFile(buffer_reader) - output_table = orc_file.read() - assert table.equals(output_table) - # Check for default WriteOptions - assert orc_file.compression == 'UNCOMPRESSED' - assert orc_file.file_version == '0.11' - assert orc_file.row_index_stride == 20000 - assert orc_file.compression_size == 65536 - def test_buffer_readwrite_with_bad_writeoptions(): from pyarrow import orc diff --git a/python/pyarrow/tests/test_pandas.py b/python/pyarrow/tests/test_pandas.py index 9421b3452696..2391cb260009 100644 --- a/python/pyarrow/tests/test_pandas.py +++ b/python/pyarrow/tests/test_pandas.py @@ -4303,6 +4303,13 @@ def test_dictionary_from_pandas_specified_type(): with pytest.raises(pa.ArrowInvalid): result = pa.array(cat, type=typ) + # mismatching values type that used to be ignored with a + # FutureWarning -> raise error + int_cat = pd.Categorical([1, 2, 1]) + typ = pa.dictionary(index_type=pa.int8(), value_type=pa.string()) + with pytest.raises(TypeError): + pa.array(int_cat, type=typ) + # mismatching order -> raise error typ = pa.dictionary( index_type=pa.int8(), value_type=pa.string(), ordered=True) diff --git a/python/pyarrow/tests/test_schema.py b/python/pyarrow/tests/test_schema.py index b35b5350a814..01bf3c31a09b 100644 --- a/python/pyarrow/tests/test_schema.py +++ b/python/pyarrow/tests/test_schema.py @@ -400,12 +400,8 @@ def test_schema_duplicate_fields(): assert sch[0].name == 'foo' assert sch[0].type == fields[0].type - with pytest.warns(FutureWarning): - assert sch.field_by_name('bar') == fields[1] - with pytest.warns(FutureWarning): - assert sch.field_by_name('xxx') is None - with pytest.warns((UserWarning, FutureWarning)): - assert sch.field_by_name('foo') is None + assert not hasattr(sch, 'field_by_name') + assert not hasattr(sch, 'add_metadata') # Schema::GetFieldIndex assert sch.get_field_index('foo') == -1 diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index eb02051693f2..daef9a21102f 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -2104,28 +2104,16 @@ def test_concat_tables_with_different_schema_metadata(): assert table2.schema.equals(table3.schema) -def test_concat_tables_with_promote_option(): +def test_concat_tables_removed_promote_option(): + # The deprecated ``promote`` keyword was removed in favor of + # ``promote_options`` t1 = pa.Table.from_arrays( [pa.array([1, 2], type=pa.int64())], ["int64_field"]) t2 = pa.Table.from_arrays( [pa.array([1.0, 2.0], type=pa.float32())], ["float_field"]) - with pytest.warns(FutureWarning): - result = pa.concat_tables([t1, t2], promote=True) - - assert result.equals(pa.Table.from_arrays([ - pa.array([1, 2, None, None], type=pa.int64()), - pa.array([None, None, 1.0, 2.0], type=pa.float32()), - ], ["int64_field", "float_field"])) - - t1 = pa.Table.from_arrays( - [pa.array([1, 2], type=pa.int64())], ["f"]) - t2 = pa.Table.from_arrays( - [pa.array([1, 2], type=pa.float32())], ["f"]) - - with pytest.raises(pa.ArrowInvalid, match="Schema at index 1 was different:"): - with pytest.warns(FutureWarning): - pa.concat_tables([t1, t2], promote=False) + with pytest.raises(TypeError): + pa.concat_tables([t1, t2], promote=True) def test_concat_tables_with_promotion(): diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi index 4f1bb0f652b5..c18bc2c9fa71 100644 --- a/python/pyarrow/types.pxi +++ b/python/pyarrow/types.pxi @@ -3211,35 +3211,6 @@ cdef class Schema(_Weakrefable): cdef int index = _normalize_index(i, self.schema.num_fields()) return pyarrow_wrap_field(self.schema.field(index)) - def field_by_name(self, name): - """ - DEPRECATED - - Parameters - ---------- - name : str - - Returns - ------- - field: pyarrow.Field - """ - cdef: - vector[shared_ptr[CField]] results - - warnings.warn( - "The 'field_by_name' method is deprecated, use 'field' instead", - FutureWarning, stacklevel=2) - - results = self.schema.GetAllFieldsByName(tobytes(name)) - if results.size() == 0: - return None - elif results.size() > 1: - warnings.warn("Schema field name corresponds to more " - "than one field", UserWarning) - return None - else: - return pyarrow_wrap_field(results[0]) - def get_field_index(self, name): """ Return index of the unique field with the given name. @@ -3453,19 +3424,6 @@ cdef class Schema(_Weakrefable): return pyarrow_wrap_schema(new_schema) - def add_metadata(self, metadata): - """ - DEPRECATED - - Parameters - ---------- - metadata : dict - Keys and values must be string-like / coercible to bytes - """ - warnings.warn("The 'add_metadata' method is deprecated, use " - "'with_metadata' instead", FutureWarning, stacklevel=2) - return self.with_metadata(metadata) - def with_metadata(self, metadata): """ Add metadata as dict of string keys and values to Schema From c620d16a0ad83f55d935b9ddf302ca18e6f8323a Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Tue, 13 Oct 2026 12:00:39 +0100 Subject: [PATCH 2/3] Remove leftover **kwargs from concat_tables The promote= handling was deleted but the signature still swallowed unknown keywords, so promote=True was silently ignored. --- python/pyarrow/table.pxi | 2 +- python/pyarrow/tests/test_table.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index e987b59a8106..30fff040fc37 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -6245,7 +6245,7 @@ def table(data, names=None, schema=None, metadata=None, nthreads=None): "Expected pandas DataFrame, python dictionary or list of arrays") -def concat_tables(tables, MemoryPool memory_pool=None, str promote_options="none", **kwargs): +def concat_tables(tables, MemoryPool memory_pool=None, str promote_options="none"): """ Concatenate pyarrow.Table objects. diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index daef9a21102f..b1af245be4b2 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -2106,14 +2106,15 @@ def test_concat_tables_with_different_schema_metadata(): def test_concat_tables_removed_promote_option(): # The deprecated ``promote`` keyword was removed in favor of - # ``promote_options`` - t1 = pa.Table.from_arrays( - [pa.array([1, 2], type=pa.int64())], ["int64_field"]) - t2 = pa.Table.from_arrays( - [pa.array([1.0, 2.0], type=pa.float32())], ["float_field"]) + # ``promote_options``. Use matching schemas so that the failure can only + # come from the rejected keyword, not from the concatenation itself. + t1 = pa.Table.from_arrays([pa.array([1, 2], type=pa.int64())], ["f"]) + t2 = pa.Table.from_arrays([pa.array([3, 4], type=pa.int64())], ["f"]) - with pytest.raises(TypeError): + with pytest.raises(TypeError, match="promote"): pa.concat_tables([t1, t2], promote=True) + with pytest.raises(TypeError, match="promote"): + pa.concat_tables([t1, t2], promote=False) def test_concat_tables_with_promotion(): From 87b2431a830ad666f310b5e053a991a0d2ed8b2c Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Tue, 13 Oct 2026 15:34:52 +0100 Subject: [PATCH 3/3] Keep _filters_to_expression as a FutureWarning alias Per review, retain the alias for a few more releases but upgrade the warning from DeprecationWarning to FutureWarning so users see it before removal. Add a test covering the alias and warning type. --- python/pyarrow/parquet/core.py | 8 +++++++- python/pyarrow/tests/parquet/test_basic.py | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/python/pyarrow/parquet/core.py b/python/pyarrow/parquet/core.py index c994dd3b51cc..253a8a33122b 100644 --- a/python/pyarrow/parquet/core.py +++ b/python/pyarrow/parquet/core.py @@ -46,7 +46,7 @@ SortingColumn) from pyarrow.fs import (LocalFileSystem, FileType, _resolve_filesystem_and_path, _ensure_filesystem) -from pyarrow.util import guid, _is_path_like, _stringify_path +from pyarrow.util import guid, _is_path_like, _stringify_path, _deprecate_api def _check_contains_null(val): @@ -196,6 +196,11 @@ def convert_single_predicate(col, op, val): return reduce(operator.or_, disjunction_members) +_filters_to_expression = _deprecate_api( + "_filters_to_expression", "filters_to_expression", + filters_to_expression, "10.0.0", FutureWarning) + + # ---------------------------------------------------------------------- # Reading a single Parquet file @@ -2521,5 +2526,6 @@ def read_schema(where, memory_map=False, decryption_properties=None, "write_metadata", "write_table", "write_to_dataset", + "_filters_to_expression", "filters_to_expression", ) diff --git a/python/pyarrow/tests/parquet/test_basic.py b/python/pyarrow/tests/parquet/test_basic.py index 8b91090989ab..ce8c75f3c102 100644 --- a/python/pyarrow/tests/parquet/test_basic.py +++ b/python/pyarrow/tests/parquet/test_basic.py @@ -1075,3 +1075,17 @@ def test_read_table_raises_value_error_when_ds_is_unavailable(monkeypatch, sourc with pytest.raises(ValueError, match="the 'source' argument"): pq.read_table(source=source) + + +@pytest.mark.dataset +def test_filters_to_expression_deprecated_alias(): + # GH-49153: ``_filters_to_expression`` is kept for a few more releases + # as a FutureWarning-emitting alias of ``filters_to_expression``. + import pyarrow.dataset as ds + + filters = [("a", "==", 1)] + expected = pq.filters_to_expression(filters) + with pytest.warns(FutureWarning, match="_filters_to_expression is deprecated"): + result = pq._filters_to_expression(filters) + assert isinstance(result, ds.Expression) + assert result.equals(expected)