Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
25e42c8
update dependencies
emgeee Sep 9, 2024
9cea1fb
update get_logical_plan signature
emgeee Sep 9, 2024
6fca28b
remove row_number() function
emgeee Sep 9, 2024
f2b3d3b
remove unneeded dependency
emgeee Sep 9, 2024
4b45a4b
fix pyo3 warnings
emgeee Sep 10, 2024
6353aa9
update object_store dependency
emgeee Sep 10, 2024
815b6d7
change PyExpr -> PySortExpr
emgeee Sep 10, 2024
92806a8
comment out key.extract::<&PyTuple>() condition statement
emgeee Sep 10, 2024
e2fa24e
change more instances of PyExpr > PySortExpr
emgeee Sep 10, 2024
21013a7
update function signatures to use _bound versions
emgeee Sep 10, 2024
142e4ed
remove clone
emgeee Sep 10, 2024
e971add
Working through some of the sort requirement changes
timsaucer Sep 10, 2024
c89357e
remove unused import
emgeee Sep 10, 2024
8255f09
expr.display_name is deprecated, used format!() + schema_name() instead
emgeee Sep 10, 2024
df46054
expr.canonical_name() is deprecated, use format!() expr instead
emgeee Sep 10, 2024
6c27614
remove comment
emgeee Sep 10, 2024
70546e2
fix tuple extraction in dataframe.__getitem__()
emgeee Sep 10, 2024
836061f
remove unneeded import
emgeee Sep 10, 2024
4945661
Add docstring comments to SortExpr python class
emgeee Sep 10, 2024
cd04c44
change extract() to downcast()
emgeee Sep 10, 2024
afcc9f1
deprecate Expr::display_name
Michael-J-Ward Aug 10, 2024
7f6187a
fix lint errors
emgeee Sep 10, 2024
8aebaea
update datafusion commit hash
emgeee Sep 11, 2024
afa303f
fix type in cargo file for arrow features
emgeee Sep 17, 2024
f4574ec
upgrade to datafusion 42
emgeee Sep 17, 2024
88ccbd8
cleanup
emgeee Sep 17, 2024
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
Prev Previous commit
Next Next commit
deprecate Expr::display_name
  • Loading branch information
Michael-J-Ward authored and emgeee committed Sep 10, 2024
commit afcc9f1e099a80fb00886e95fa212414b0071517
11 changes: 10 additions & 1 deletion python/datafusion/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
)
from datafusion.common import NullTreatment, RexType, DataTypeMap
from typing import Any, Optional, Type
from typing_extensions import deprecated
import pyarrow as pa

# The following are imported from the internal representation. We may choose to
Expand Down Expand Up @@ -195,12 +196,20 @@ def to_variant(self) -> Any:
"""Convert this expression into a python object if possible."""
return self.expr.to_variant()

@deprecated("display_name() is deprecated. Use :py:meth:`~Expr.schema_name` instead")
def display_name(self) -> str:
"""Returns the name of this expression as it should appear in a schema.

This name will not include any CAST expressions.
"""
return self.expr.display_name()
return self.schema_name()

def schema_name(self) -> str:
"""Returns the name of this expression as it should appear in a schema.

This name will not include any CAST expressions.
"""
return self.expr.schema_name()

def canonical_name(self) -> str:
"""Returns a complete string representation of this expression."""
Expand Down
20 changes: 20 additions & 0 deletions python/datafusion/tests/test_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,23 @@ def test_expr_getitem() -> None:

assert names == ["Alice", "Bob", "Charlie", None]
assert array_values == [2, 5, None, None]


def test_display_name_deprecation():
import warnings
expr = col("foo")
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered
warnings.simplefilter("always")

# should trigger warning
name = expr.display_name()

# Verify some things
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "deprecated" in str(w[-1].message)

# returns appropriate result
assert name == expr.schema_name()
assert name == "foo"
2 changes: 1 addition & 1 deletion src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl PyExpr {

/// Returns the name of this expression as it should appear in a schema. This name
/// will not include any CAST expressions.
fn display_name(&self) -> PyResult<String> {
fn schema_name(&self) -> PyResult<String> {
Ok(format!("{}", self.expr.schema_name()))
}

Expand Down