-
Notifications
You must be signed in to change notification settings - Fork 0
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
[BSE-4155] Add support for the Aggregate relational node #39
Conversation
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.
Some notes on class structure, nitpicks elsewhere, otherwise LGTM
pydough/relational/aggregate.py
Outdated
self._aggregations: MutableMapping[str, CallExpression] = aggregations | ||
assert all( | ||
agg.is_aggregation for agg in aggregations.values() | ||
), "All functions used in aggregations must be aggregation functions" |
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.
Can avoid this if we have a special version of CallExpression just for agg calls (its inputs are only allowed to be literals or column references, nothing else) -> use type annotations to verify that the aggregations
argument maps to this special variant.
They can then check the operator passed in to make sure that its .is_aggregation
field is true.
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.
Let's consider this as a followup. I think the extra class isn't worth the safety.
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.
Also I'm not supporting literals yet. I still need to figure that out.
@@ -30,7 +30,7 @@ def inputs(self): | |||
def input(self) -> Relational: | |||
return self._input | |||
|
|||
def node_equals(self, other: "Relational") -> bool: | |||
def node_equals(self, other: Relational) -> bool: |
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.
Why is this still equals
in some places and node_equals
in other? Can we switch this to all/nothing?
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.
Everything is just node_equals
now for Relational nodes.
Adds support for the basic definition of the Aggregate relational node.