Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/source/python/api/compute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,6 @@ Compute Options
CastOptions
CountOptions
CumulativeOptions
CumulativeSumOptions
DayOfWeekOptions
DictionaryEncodeOptions
ElementWiseAggregateOptions
Expand Down
22 changes: 0 additions & 22 deletions python/pyarrow/_compute.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
39 changes: 1 addition & 38 deletions python/pyarrow/_flight.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import collections
import enum
import re
import time
import warnings
import weakref

from cython.operator cimport dereference as deref
Expand Down Expand Up @@ -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.

Expand All @@ -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

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down
42 changes: 3 additions & 39 deletions python/pyarrow/array.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion python/pyarrow/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
CastOptions,
CountOptions,
CumulativeOptions,
CumulativeSumOptions,
DayOfWeekOptions,
DictionaryEncodeOptions,
RunEndEncodeOptions,
Expand Down
9 changes: 0 additions & 9 deletions python/pyarrow/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion python/pyarrow/parquet/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def convert_single_predicate(col, op, val):

_filters_to_expression = _deprecate_api(
"_filters_to_expression", "filters_to_expression",
filters_to_expression, "10.0.0", DeprecationWarning)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is still using DeprecationWarning, we might want to leave this one in place but using FutureWarning for a few more releases before removing.

All the others looks good!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed 87b2431 :)

filters_to_expression, "10.0.0", FutureWarning)


# ----------------------------------------------------------------------
Expand Down
43 changes: 1 addition & 42 deletions python/pyarrow/table.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -6278,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.

Expand Down Expand Up @@ -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
--------
Expand Down Expand Up @@ -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)

Expand Down
14 changes: 14 additions & 0 deletions python/pyarrow/tests/parquet/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 0 additions & 6 deletions python/pyarrow/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 1 addition & 9 deletions python/pyarrow/tests/test_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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

Expand Down
Loading
Loading