-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95675c5
commit 834f176
Showing
10 changed files
with
217 additions
and
11 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
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 |
---|---|---|
@@ -1,14 +1,21 @@ | ||
from .aggregate import any_value, avg, collect, concat, count, max, min, sum | ||
from .func import Func | ||
from .func import Func, Window | ||
from .window import dense_rank, first, percent_rank, rank, row_number | ||
|
||
__all__ = [ | ||
"Func", | ||
"Window", | ||
"any_value", | ||
"avg", | ||
"collect", | ||
"concat", | ||
"count", | ||
"dense_rank", | ||
"first", | ||
"max", | ||
"min", | ||
"percent_rank", | ||
"rank", | ||
"row_number", | ||
"sum", | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from sqlalchemy import func as sa_func | ||
|
||
from datachain.sql import functions as dc_func | ||
|
||
from .func import Func | ||
|
||
|
||
def row_number() -> Func: | ||
return Func(inner=sa_func.row_number, result_type=int, is_window=True) | ||
|
||
|
||
def rank() -> Func: | ||
return Func(inner=sa_func.rank, result_type=int, is_window=True) | ||
|
||
|
||
def dense_rank() -> Func: | ||
return Func(inner=dc_func.dense_rank, result_type=int, is_window=True) | ||
|
||
|
||
def percent_rank() -> Func: | ||
return Func(inner=dc_func.percent_rank, result_type=float, is_window=True) | ||
|
||
|
||
def first(col: str) -> Func: | ||
return Func(inner=sa_func.first_value, col=col, is_window=True) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from sqlalchemy.sql.functions import GenericFunction | ||
|
||
|
||
class dense_rank(GenericFunction): # noqa: N801 | ||
inherit_cache = True | ||
|
||
|
||
class percent_rank(GenericFunction): # noqa: N801 | ||
inherit_cache = True |
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