Skip to content
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

Merged
merged 89 commits into from
Nov 14, 2024

Conversation

njriasan
Copy link
Contributor

Adds support for the basic definition of the Aggregate relational node.

Copy link
Contributor

@knassre-bodo knassre-bodo left a 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

Comment on lines 36 to 39
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"
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Base automatically changed from nick/limit to main November 14, 2024 19:55
@njriasan njriasan merged commit c451f65 into main Nov 14, 2024
4 checks passed
@njriasan njriasan deleted the nick/aggregate branch November 14, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants