Skip to content

Commit e70cd28

Browse files
committed
display_name has been deprecated since DF42
1 parent 1b77551 commit e70cd28

2 files changed

Lines changed: 0 additions & 36 deletions

File tree

python/datafusion/expr.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727
from collections.abc import Iterable, Sequence
2828
from typing import TYPE_CHECKING, Any, ClassVar
2929

30-
try:
31-
from warnings import deprecated # Python 3.13+
32-
except ImportError:
33-
from typing_extensions import deprecated # Python 3.12
34-
3530
import pyarrow as pa
3631

3732
from ._internal import expr as expr_internal
@@ -356,16 +351,6 @@ def to_variant(self) -> Any:
356351
"""Convert this expression into a python object if possible."""
357352
return self.expr.to_variant()
358353

359-
@deprecated(
360-
"display_name() is deprecated. Use :py:meth:`~Expr.schema_name` instead"
361-
)
362-
def display_name(self) -> str:
363-
"""Returns the name of this expression as it should appear in a schema.
364-
365-
This name will not include any CAST expressions.
366-
"""
367-
return self.schema_name()
368-
369354
def schema_name(self) -> str:
370355
"""Returns the name of this expression as it should appear in a schema.
371356

python/tests/test_expr.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -319,27 +319,6 @@ def test_expr_getitem() -> None:
319319
assert array_values == [2, 5, None, None]
320320

321321

322-
def test_display_name_deprecation():
323-
import warnings
324-
325-
expr = col("foo")
326-
with warnings.catch_warnings(record=True) as w:
327-
# Cause all warnings to always be triggered
328-
warnings.simplefilter("always")
329-
330-
# should trigger warning
331-
name = expr.display_name()
332-
333-
# Verify some things
334-
assert len(w) == 1
335-
assert issubclass(w[-1].category, DeprecationWarning)
336-
assert "deprecated" in str(w[-1].message)
337-
338-
# returns appropriate result
339-
assert name == expr.schema_name()
340-
assert name == "foo"
341-
342-
343322
@pytest.fixture
344323
def df():
345324
ctx = SessionContext()

0 commit comments

Comments
 (0)