In Citus, we support aggregate functions by whitelisting them in planning time by ingesting proper aggregate functions into the worker and master queries separately. We process the aggregates in MasterAggregateExpression and WorkerAggregateExpressionList.
If we inspect the code paths in these functions, we can easily see that there are a good amount of code duplications in between the if - else if blocks. For example, these two PRs are almost identical, #2186 and #2175.
We need more generic functions to produce the necessary aggregates from the given master and worker aggregate function names. One very basic and (not even) a half implemented method for master aggregate can be seen in custom_aggregate_support branch in this line
In Citus, we support aggregate functions by whitelisting them in planning time by ingesting proper aggregate functions into the worker and master queries separately. We process the aggregates in MasterAggregateExpression and WorkerAggregateExpressionList.
If we inspect the code paths in these functions, we can easily see that there are a good amount of code duplications in between the
if
-else if
blocks. For example, these two PRs are almost identical, #2186 and #2175.We need more generic functions to produce the necessary aggregates from the given master and worker aggregate function names. One very basic and (not even) a half implemented method for master aggregate can be seen in custom_aggregate_support branch in this line