-
Notifications
You must be signed in to change notification settings - Fork 50
refactor: generalize aggregation to handle 0,1, or 2 inputs #360
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
Conversation
52c78a5
to
21e7445
Compare
) -> ibis_types.Value: | ||
return compile_agg(op, input) | ||
if isinstance(aggregate, ex.UnaryAggregation): |
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.
Note to self: Is there another class for 0 argument aggregations (e.g. row count) that we need to handle here?
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.
CL title is a lie, I haven't actually defined the 0-arg aggregation ops yet. They still pretend to be 1-arg aggregations. Will convert 0-arg ops (rank is another one) in a follow-up pr.
@@ -382,6 +418,19 @@ def _( | |||
) | |||
|
|||
|
|||
@compile_binary_agg.register | |||
def _( |
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.
Not a change introduced in this PR, but it's a bit odd to see functions with name _
outside of a closure function. Even though the name isn't really relevant, as we're relying on type-based dispatching, I'd expect more than a 1-character name.
https://google.github.io/styleguide/pyguide.html#3161-names-to-avoid
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.
The code examples for @singledispatch in https://docs.python.org/3/library/functools.html use the _
naming for overrides. Also the linter wants unique name for each implementation if it is not _
. I can change though if this goes against our style guidelines.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕