Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
CREATE TABLE t (a INT); |
INSERT INTO t VALUES(1),(2),(3),(4),(4); |
SELECT a, SUM(a), SUM(a) OVER (ORDER BY SUM(a)) FROM t GROUP BY a; |
SELECT a, SUM(a), SUM(a) OVER (ORDER BY SUM(a)+1) FROM t GROUP BY a; # expected result 1,3,6,10 |
SELECT SUM(a) OVER (PARTITION BY SUM(a)) FROM t GROUP BY a; |
SELECT SUM(a) OVER (PARTITION BY SUM(a)+1) FROM t GROUP BY a; # expected result 1,3,6,10 |
MariaDB [test]> SELECT a, SUM(a), SUM(a) OVER (ORDER BY SUM(a)) FROM t GROUP BY a;
|
+------+--------+-------------------------------+
|
| a | SUM(a) | SUM(a) OVER (ORDER BY SUM(a)) |
|
+------+--------+-------------------------------+
|
| 1 | 1 | 1 |
|
| 2 | 2 | 3 |
|
| 3 | 3 | 6 |
|
| 4 | 8 | 10 |
|
+------+--------+-------------------------------+
|
4 rows in set (0.00 sec)
|
|
MariaDB [test]> SELECT a, SUM(a), SUM(a) OVER (ORDER BY SUM(a)+1) FROM t GROUP BY a;
|
+------+--------+---------------------------------+
|
| a | SUM(a) | SUM(a) OVER (ORDER BY SUM(a)+1) |
|
+------+--------+---------------------------------+
|
| 1 | 1 | 10 |
|
| 2 | 2 | 10 |
|
| 3 | 3 | 10 |
|
| 4 | 8 | 10 |
|
+------+--------+---------------------------------+
|
4 rows in set (0.01 sec)
|
|
MariaDB [test]> SELECT SUM(a) OVER (PARTITION BY SUM(a)) FROM t GROUP BY a;
|
+-----------------------------------+
|
| SUM(a) OVER (PARTITION BY SUM(a)) |
|
+-----------------------------------+
|
| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
+-----------------------------------+
|
4 rows in set (0.00 sec)
|
|
MariaDB [test]> SELECT SUM(a) OVER (PARTITION BY SUM(a)+1) FROM t GROUP BY a;
|
+-------------------------------------+
|
| SUM(a) OVER (PARTITION BY SUM(a)+1) |
|
+-------------------------------------+
|
| 10 |
|
| 10 |
|
| 10 |
|
| 10 |
|
+-------------------------------------+
|
4 rows in set (0.00 sec)
|
Attachments
Issue Links
- is duplicated by
-
MDEV-18373 DENSE_RANK is not calculated correctly
- Closed