Skip to content
Open
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
8 changes: 8 additions & 0 deletions python/pyarrow/table.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -6292,6 +6292,8 @@ def concat_tables(tables, MemoryPool memory_pool=None, str promote_options="none
promote_options : str, default none
Accepts strings "none", "default" and "permissive".
**kwargs : dict, optional
Additional arguments. The deprecated ``promote`` argument is accepted
for backward compatibility.

Examples
--------
Expand Down Expand Up @@ -6321,6 +6323,12 @@ def concat_tables(tables, MemoryPool memory_pool=None, str promote_options="none
CConcatenateTablesOptions options = (
CConcatenateTablesOptions.Defaults())

unexpected_kwargs = [key for key in kwargs if key != "promote"]
if unexpected_kwargs:
raise TypeError(
f"concat_tables() got an unexpected keyword argument "
f"'{unexpected_kwargs[0]}'")

if "promote" in kwargs:
warnings.warn(
"promote has been superseded by promote_options='default'.",
Expand Down
9 changes: 9 additions & 0 deletions python/pyarrow/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,15 @@ def test_concat_tables_invalid_option():
pa.concat_tables([t, t], promote_options="invalid")


def test_concat_tables_rejects_unknown_keyword_arguments():
t = pa.Table.from_arrays([list(range(10))], names=('a',))

with pytest.raises(
TypeError,
match="unexpected keyword argument 'totally_bogus_kwarg'"):
pa.concat_tables([t, t], totally_bogus_kwarg=True)


def test_concat_tables_none_table():
# ARROW-11997
with pytest.raises(AttributeError):
Expand Down