Skip to content

Commit

Permalink
refactor(selectors): remove inefficient positions API
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jul 20, 2024
1 parent ba6e414 commit e2557f0
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions ibis/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,6 @@ def expand(self, table: ir.Table) -> Sequence[ir.Value]:
"""

def positions(self, table: ir.Table) -> Sequence[int]:
"""Expand `table` into column indices that match the selector.
Parameters
----------
table
An ibis table expression
Returns
-------
Sequence[int]
A sequence of column indices where the selector matches
"""
raise NotImplementedError(
f"`positions` doesn't make sense for {self.__class__.__name__} selector"
)


class Predicate(Selector):
predicate: Callable[[ir.Value], bool]
Expand All @@ -122,11 +104,6 @@ def expand(self, table: ir.Table) -> Sequence[ir.Value]:
"""
return [col for column in table.columns if self.predicate(col := table[column])]

def positions(self, table: ir.Table) -> Sequence[int]:
return [
i for i, column in enumerate(table.columns) if self.predicate(table[column])
]

def __and__(self, other: Selector) -> Predicate:
"""Compute the conjunction of two `Selector`s.
Expand Down

0 comments on commit e2557f0

Please sign in to comment.