-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): support selectors in window function
order_by
and `group…
…_by`
- Loading branch information
Showing
5 changed files
with
79 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from __future__ import annotations | ||
|
||
import abc | ||
from typing import TYPE_CHECKING | ||
|
||
from ibis.common.grounds import Concrete | ||
|
||
if TYPE_CHECKING: | ||
from collections.abc import Sequence | ||
|
||
import ibis.expr.types as ir | ||
|
||
|
||
class Selector(Concrete): | ||
"""A column selector.""" | ||
|
||
@abc.abstractmethod | ||
def expand(self, table: ir.Table) -> Sequence[ir.Value]: | ||
"""Expand `table` into value expressions that match the selector. | ||
Parameters | ||
---------- | ||
table | ||
An ibis table expression | ||
Returns | ||
------- | ||
Sequence[Value] | ||
A sequence of value expressions that match the selector | ||
""" | ||
|
||
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" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters