[MDEV-18373] DENSE_RANK is not calculated correctly Created: 2019-01-24 Updated: 2023-10-31 Resolved: 2019-05-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Affects Version/s: | 10.3.11, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.2.24, 10.3.15, 10.4.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Yekaterina | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 3.10.0-862.el7.x86_64 #1 |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
We encountered a case when DENSE_RANK() window function does not work correctly.
case 1 - Correct results:
case 2 - Wrong results:
|
| Comments |
| Comment by Alice Sherepa [ 2019-01-25 ] | ||||||||||||||||||||||||||
|
Thanks a lot for the report! Reproducible on 10.2-10.4
| ||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-03-08 ] | ||||||||||||||||||||||||||
|
Patch | ||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2019-05-01 ] | ||||||||||||||||||||||||||
|
Varun, | ||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-05-03 ] | ||||||||||||||||||||||||||
|
Patch (after addressing the above requests) | ||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2019-05-04 ] | ||||||||||||||||||||||||||
|
Ok to push into 10.2 | ||||||||||||||||||||||||||
| Comment by namh [ 2023-10-05 ] | ||||||||||||||||||||||||||
|
This issue is showed on latest mariadb versions. my test query :
I've run a query with calculation DENSE_RANK. I got an right answer on version, '10.6.10-MariaDB-1:10.6.10+maria~ubu2004' I've used the Podman/Windows WSL The versions i've tested
I've tested with windows version MariaDB (MSI installer), too. only works well in 10.6.10 | ||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2023-10-17 ] | ||||||||||||||||||||||||||
|
i5on9i Could you please open a separate bug report for that? Please add also CREATE TABLE... and also I guess there is a lack of a bracket here:"(DENSE_RANK() OVER (ORDER BY `mytable`.`id` ASC) + 1 AS total" - what do you mean there? | ||||||||||||||||||||||||||
| Comment by namh [ 2023-10-30 ] | ||||||||||||||||||||||||||
|
Could you please open a separate bug report for that? I guess there is a lack of a bracket here:"(DENSE_RANK() OVER (ORDER BY `mytable`.`id` ASC) + 1 AS total" (DENSE_RANK () OVER (ORDER BY `mytable`.`id` ASC) + 1) AS total | ||||||||||||||||||||||||||
| Comment by namh [ 2023-10-30 ] | ||||||||||||||||||||||||||
|
@alice.sherepa I've tested again, in my computer again(windows + podman) I tried to reproduce it, but it looks just works well. tested versions:
Sorry for bothering. My poor guess is that something was wrong with my windows PC because that was in pre-update state. take care. | ||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2023-10-31 ] | ||||||||||||||||||||||||||
|
i5on9i I’m glad to hear that it works well! |