[MDEV-9526] Compute Aggregate functions as window functions Created: 2016-02-06 Updated: 2019-04-11 Resolved: 2019-04-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Fix Version/s: | 10.2.12 |
| Type: | Task | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Sprint: | 10.2.0-7, 10.2.12 | ||||||||||||||||||||
| Description |
| Comments |
| Comment by Sergei Petrunia [ 2016-02-09 ] |
|
Some info about window frames: There are two kinds, ROWS-based and RANGE-based. ROWS-based frame counts physical rows. CURRENT ROW means the current row, $n PRECEDING or $n FOLLOWING means $n preceding or following rows in the partition. RANGE-based frame counts values. CURRENT ROW means current row, as well as all rows that sort together with the current row. |
| Comment by Sergei Petrunia [ 2016-02-17 ] |
|
Working on getting COUNT() to work on ROWS-based frames. COUNT() is a simple aggregate function that supports value removal. Using this : https://gist.github.com/spetrunia/518c6ff06bd413ab202d for cursor cloning. |
| Comment by Sergei Petrunia [ 2016-02-17 ] |
|
On the call yesterday, it was discussed that we only need to check for partition bound when advancing the first cursor (this is always the frame start cursor). Maybe, we could count number of rows in the partition. The first cursor that reaches partition end sets the number. Other cursors can only check if #rows_seen_in_partition == total_rows_in_partition. |