Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.3.1-1, 10.3.1-2, 10.3.3-1
Description
With CREATE FUNCTION one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like SUM, AVG, etc). This task is to add support for aggregate stored functions.
Syntax
is not decided yet. SQL Standard 2003 doesn't support aggregate stored functions (may be the newer standard does). Oracle, PostgreSQL, HSQL (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. SQL Server and DB2 do not support creating new aggregate stored functions in SQL.
The syntax should at least allow for
- the code to return the function value
- the code to be called per row in a group, it accumulates data, does not return a value
- storage that is preserved between calls within a group
and possibly
- code to invoke between groups to reset the storage
- code to remove data from the group (useful for window functions)
Attachments
Issue Links
- relates to
-
MDEV-14520 Custom aggregate functions work incorrectly with WITH ROLLUP clause
-
- Closed
-
-
MDEV-24580 Aggregate stored function return always NULL in case of empty input set
-
- Open
-
-
MCOL-523 support user defined aggregate functions
-
- Closed
-
-
MDEV-11263 Aggregate Window Functions
-
- Stalled
-
-
MDEV-11301 SUGGESTION: Increase the number of Aggregate Functions
-
- Open
-
-
MDEV-14564 support FOR loop in stored aggregate functions
-
- Stalled
-
-
MDEV-28849 I_S tables don't tell that the stored function is AGGREGATE
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. .h2 Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). Oracle, PostgreSQL, HSQL (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). Oracle, PostgreSQL, HSQL (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group |
Description |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). Oracle, PostgreSQL, HSQL (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group |
Workflow | MariaDB v2 [ 60114 ] | MariaDB v3 [ 64604 ] |
Fix Version/s | 10.2 [ 14601 ] |
Labels | gsoc15 | gsoc16 |
Labels | gsoc16 | gsoc15 gsoc16 |
Description |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group * and possibly ** code to invoke between groups to reset the storage ** code to *remove* data from the group (useful for window functions) |
Description |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group * and possibly ** code to invoke between groups to reset the storage ** code to *remove* data from the group (useful for window functions) |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group and possibly * code to invoke between groups to reset the storage * code to *remove* data from the group (useful for window functions) |
Description |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group and possibly * code to invoke between groups to reset the storage * code to *remove* data from the group (useful for window functions) |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group and possibly * code to invoke between groups to reset the storage * code to *remove* data from the group (useful for window functions) |
Description |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions. h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate storage functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group and possibly * code to invoke between groups to reset the storage * code to *remove* data from the group (useful for window functions) |
With {{CREATE FUNCTION}} one can create functions in SQL, but this syntax doesn't allow one to create an aggregate function (like {{SUM}}, {{AVG}}, etc). This task is to add support for aggregate stored functions.
h2. Syntax is not decided yet. SQL Standard 2003 doesn't support aggregate stored functions (may be the newer standard does). [Oracle|http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dciaggfns.htm], [PostgreSQL|http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html], [HSQL|http://hsqldb.org/doc/guide/sqlroutines-chapt.html#src_aggregate_functions] (may be more) all implement aggregate stored functions using their own incompatible syntax extensions. SQL Server and DB2 do not support creating new aggregate stored functions in SQL. The syntax should at least allow for * the code to return the function value * the code to be called per row in a group, it accumulates data, does not return a value * storage that is preserved between calls within a group and possibly * code to invoke between groups to reset the storage * code to *remove* data from the group (useful for window functions) |
Assignee | Vicentiu Ciorbaru [ cvicentiu ] |
Priority | Minor [ 4 ] | Major [ 3 ] |
Fix Version/s | 10.2 [ 14601 ] |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.2 [ 14601 ] |
Assignee | Vicentiu Ciorbaru [ cvicentiu ] | Varun Gupta [ varun ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Sprint | 10.3.1-1 [ 164 ] |
Rank | Ranked lower |
Link | This issue relates to MDEV-11301 [ MDEV-11301 ] |
Assignee | Varun Gupta [ varun ] | Vicentiu Ciorbaru [ cvicentiu ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Labels | gsoc15 gsoc16 | 10.3-beta gsoc15 gsoc16 |
Priority | Major [ 3 ] | Critical [ 2 ] |
Epic Link | PT-57 [ 62149 ] |
Sprint | 10.3.1-1 [ 164 ] | 10.3.1-1, 10.3.1-2 [ 164, 174 ] |
Rank | Ranked higher |
Sprint | 10.3.1-1, 10.3.1-2 [ 164, 174 ] | 10.3.1-1, 10.3.1-2, 10.3.3-1 [ 164, 174, 200 ] |
Assignee | Vicentiu Ciorbaru [ cvicentiu ] | Varun Gupta [ varun ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Link |
This issue relates to |
Link | This issue relates to MDEV-11263 [ MDEV-11263 ] |
Fix Version/s | 10.3.3 [ 22644 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Link | This issue relates to MDEV-24580 [ MDEV-24580 ] |
Workflow | MariaDB v3 [ 64604 ] | MariaDB v4 [ 132581 ] |
Link | This issue relates to MDEV-14564 [ MDEV-14564 ] |
Link | This issue relates to MDEV-28849 [ MDEV-28849 ] |
A possible approach is to have only one function that does everything — accumulates and returns the result. This is what HSQL has:
...
here the first argument — x — is the actual argument of the aggregate function (called as SELECT udagv(x) ...), the second — flag — tells where to accumulate or return the result, the last two — acc and counter — are the storage, their value is preserved between calls and automatically reset to NULL when a new group starts.
The function then does something like