Details
-
Task
-
Status: Stalled (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
10.2.4-4
Description
With a few exceptions, most native aggregate functions are supported as window functions.
https://mariadb.com/kb/en/library/aggregate-functions-as-window-functions/
In MDEV-7773, support for creating of custom aggregate functions was added.
This task proposes to extend that feature and allow custom aggregate functions to be used as window functions
An example of a creating a custom aggregate function is given below:
create aggregate function agg_sum(x INT) returns double |
begin
|
declare z double default 0; |
declare continue handler for not found return z; |
loop
|
fetch group next row; |
set z = z + x; |
end loop; |
end| |
This functions can be used in the following query:
create table balances (id int, amount int); |
insert into balances values (1, 10), (2, 20), (3, 30); |
 |
select agg_sum(amount) from balances; |
After this task is complete the following must also work:
select agg_sum(amount) over (order by id); |
Attachments
Issue Links
- relates to
-
MDEV-7773 Aggregate stored functions
- Closed