[MDEV-15204] LAG function doesn't require ORDER BY in OVER clause Created: 2018-02-04 Updated: 2019-05-05 Resolved: 2019-05-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Affects Version/s: | 10.2, 10.3 |
| Fix Version/s: | 10.2.18, 10.3.10, 10.4.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vicențiu Ciorbaru | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | beginner-friendly | ||
| Description |
|
Our current implementation selects an ordering for rows implicitly. This can lead to results that look like this:
The ordering used by lag is (ORDER BY a), but we don't return the rows in this order. Also, this would be quite confusing if multiple window functions are used. Instead of running this query like this and produce confusing results, we should return an error of the form:
|
| Comments |
| Comment by Vicențiu Ciorbaru [ 2018-02-04 ] | |
|
Lag should behave like rank() function. Calling rank() over () results in the error:
|