Skip to content

Commit

Permalink
refactor(api): remove deprecated Table.sort_by() and `Table.groupby…
Browse files Browse the repository at this point in the history
…()` methods

BREAKING CHANGE: removed `Table.sort_by()` and `Table.groupby()`, use `.order_by()` and `.group_by()` respectively
  • Loading branch information
kszucs authored and cpcloud committed Apr 13, 2023
1 parent d7f0be0 commit 1316635
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
17 changes: 0 additions & 17 deletions ibis/expr/types/relations.py
Expand Up @@ -25,7 +25,6 @@
if TYPE_CHECKING:
import pandas as pd

import ibis.expr.schema as sch
import ibis.selectors as s
import ibis.expr.types as ir
from ibis.common.typing import SupportsSchema
Expand Down Expand Up @@ -543,22 +542,6 @@ def __getattr__(self, key: str) -> ir.Column:
with contextlib.suppress(com.IbisTypeError):
return ops.TableColumn(self, key).to_expr()

# Handle deprecated `groupby` and `sort_by` methods
if key == "groupby":
warnings.warn(
"`Table.groupby` is deprecated and will be removed in 5.0, "
"use `Table.group_by` instead",
FutureWarning,
)
return self.group_by
elif key == "sort_by":
warnings.warn(
"`Table.sort_by` is deprecated and will be removed in 5.0, "
"use `Table.order_by` instead",
FutureWarning,
)
return self.order_by

# A mapping of common attribute typos, mapping them to the proper name
common_typos = {
"sort": "order_by",
Expand Down
14 changes: 0 additions & 14 deletions ibis/tests/expr/test_table.py
Expand Up @@ -426,13 +426,6 @@ def test_limit(table):
assert limited.op().offset == 5


def test_sort_by_deprecated(table):
with pytest.warns(FutureWarning):
x = table.sort_by("f")
y = table.order_by("f")
assert x.equals(y)


def test_order_by(table):
result = table.order_by(['f']).op()

Expand Down Expand Up @@ -632,13 +625,6 @@ def test_aggregate_keywords(table):
assert_equal(expr2, expected)


def test_groupby_alias(table):
expected = table.group_by('g').size()
with pytest.warns(FutureWarning, match="deprecated"):
result = table.groupby('g').size()
assert_equal(result, expected)


def test_filter_aggregate_pushdown_predicate(table):
# In the case where we want to add a predicate to an aggregate
# expression after the fact, rather than having to backpedal and add it
Expand Down

0 comments on commit 1316635

Please sign in to comment.