-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(api): support selectors in window function order_by
and group_by
#9649
feat(api): support selectors in window function order_by
and group_by
#9649
Conversation
0f0cca6
to
2d4a7ba
Compare
if TYPE_CHECKING: | ||
from collections.abc import Sequence | ||
|
||
import ibis.expr.types as ir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to move the base selector class to ibis.common
since it is tied to ir.Table
.
I think Selector
s could be viewed as another kind of deferred (or rather Resolver
) producing a sequence of outputs and deferreds are decoupled from the ir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly even bind()
would properly handle that, so refactoring selectors as Resolver
s could simplify the codebase, but that should be done in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the class to avoid an import cycle and having it anywhere else didn't really fit.
If you have another suggestion that isn't to refactor the whole class :) I'm happy to hear it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, I wasn't aware of the import cycle.
2d4a7ba
to
85faac8
Compare
groupings: VarTuple[Union[str, Resolver, ops.Value]] = () | ||
orderings: VarTuple[Union[str, Resolver, ops.SortKey]] = () | ||
groupings: VarTuple[Union[str, Resolver, Selector, ops.Value]] = () | ||
orderings: VarTuple[Union[str, Resolver, Selector, ops.SortKey]] = () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's a bit of noise from dealing with the import cycle from using Selector
at the top level of builders.py
, I'm calling out that this is the change that enables use of a Selector
in the group_by
and order_by
window APIs.
We're already calling Table.bind
on these two fields in the appropriate place, we simply needed to allow them in the signature of this builder to allow them to get passed through the API.
85faac8
to
60fa0b1
Compare
Support selectors in window function
group_by
andorder_by
arguments. Closes #9637.