-
-
Notifications
You must be signed in to change notification settings - Fork 39
array_agg support and general framework for postgres aggregate functions #1497
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
|
|
Hydrocharged
left a comment
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.
My biggest questions revolve around how this extends off of GMS. Looking at the documentation, it looks like aggregate functions are composed of two internal functions. One that updates some internal state, and another that "finalizes" it. In all, that seems like a simpler abstraction than this, since it should work with all of the overload resolution logic and everything else. It would just be an extension on our existing CompiledFunction.
It's something we'll have to do anyway to support CREATE AGGREGATE, and it seems simpler overall, but perhaps you've already looked into this and it's not as straightforward as it seems, so would love to get your opinions on that.
My main thought is that I want to unify the aggregation planning between GMS and Doltgres. If we need to make changes to GMS to accommodate user-defined aggregations that's fine, but I don't think we need to re-write the GMS planning / execution just to get built-in postgres aggregates working. I think we can get a long way without supporting user-defined aggregates. I want to evolve this integration over time so we have a single aggregate abstraction, planning mode, and execution strategy driven by GMS. I can buy that postgres's internal way of updating aggregate func state is the right way forward, but I don't want to unify those models just yet. |
fulghum
left a comment
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.
Looks good!
Other aggregate functions will require type overload resolution logic that this first function, array_agg, does not.
Also not yet supported: the
ORDER BYclause in the function, e.g.:array_agg ( anyarray ORDER BY input_sort_columns )Relies on dolthub/go-mysql-server#2992