[MCOL-1759] Implement regr_sxx, regr_syy, regr_sxy and corr functions as UDAF Created: 2018-10-01 Updated: 2018-10-29 Resolved: 2018-10-15 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | 1.2 |
| Fix Version/s: | 1.2.0 |
| Type: | New Feature | Priority: | Major |
| Reporter: | David Hall (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 2018-18 | ||||||||
| Description |
|
We have a requirement to implement the regr_xxx functions for Columnstore. The list of functions to implement did not include regr_sxx, reg_syy or regr_sxy. These functions seem to be part of most other database offerings and should be part of ours. Also, the corr(x, y) function appears to be in everyone's library as well. These functions are trivial to implement within the UDAF API. Writing test cases will take longer than implementation. |
| Comments |
| Comment by David Hall (Inactive) [ 2018-10-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Add covar_pop and covar_samp as well. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2018-10-09 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Roman, thought you might like these. May help shed light on the API. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Hall (Inactive) [ 2018-10-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test: When used when innodb right now, these functions are rounded to two decimal places. These are not native MariaDB Server functions, but rather the result of implementing them as Server UDAF, since we need the stubs anyway. CREATE TABLE aggr(k int, v decimal(10,2), v2 decimal(10, 2))engine=columnstore; SELECT k, CORR(v, v2) FROM aggr GROUP BY k;
-----
-----
-----
----- SELECT k, COVAR_POP(v, v2) FROM aggr GROUP BY k;
-- SELECT k, COVAR_POP(v, v2) FROM aggr_innodb GROUP BY k;
-----
----- SELECT k, COVAR_SAMP(v, v2) FROM aggr GROUP BY k;
-----
----- SELECT k, COVAR_SAMP(v, v2) FROM aggr_innodb GROUP BY k;
-----
----- select k, regr_sxx(v, v2) from aggr group by k;
-----
----- select k, regr_sxx(v, v2) from aggr_innodb group by k;
-----
----- select k, regr_sxy(v, v2) from aggr group by k;
-----
----- select k, regr_sxy(v, v2) from aggr_innodb group by k;
-----
----- select k, regr_syy(v, v2) from aggr group by k;
-----
----- select k, regr_syy(v, v2) from aggr_innodb group by k;
-----
----- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2018-10-15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Build verified: 1.2.0a Functions were created. Result differences are being tracked in a separate ticket. |