[MDEV-21318] Wrong results with window functions and implicit grouping Created: 2019-12-13  Updated: 2020-06-19  Resolved: 2019-12-26

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - Window functions
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.2.31, 10.3.22, 10.4.12, 10.5.1

Type: Bug Priority: Major
Reporter: Varun Gupta (Inactive) Assignee: Varun Gupta (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-20012 Window function multiplication on emp... Closed
Relates
relates to MDEV-20012 Window function multiplication on emp... Closed

 Description   

MariaDB [test]> create table t1(a int) engine=MYISAM;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [test]> SELECT sum(1) as x, row_number() OVER() FROM t1;
+------+---------------------+
| x    | row_number() OVER() |
+------+---------------------+
| NULL |                NULL |
+------+---------------------+

1 row in set (0.00 sec)

The above query return NULL for the window function row_number, which is incorrect.
When we have implicit grouping window function would be executed once and the result should be 1



 Comments   
Comment by Varun Gupta (Inactive) [ 2019-12-17 ]

Patch
http://lists.askmonty.org/pipermail/commits/2019-December/014107.html

Comment by Varun Gupta (Inactive) [ 2019-12-17 ]

This fix will also fix MDEV-20012

Comment by Sergei Petrunia [ 2019-12-19 ]

A related bug which introduced the approach to fix this was: MDEV-11990

Generated at Thu Feb 08 09:06:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.