Skip to content

Commit 457f3b9

Browse files
committed
Added the test case for bug mdev-9941 that was fixed some time ago.
1 parent 4872ec6 commit 457f3b9

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

mysql-test/r/win.result

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,3 +2142,46 @@ pk a d sum_1 sum_2
21422142
10 2 0.800 1.700 2.400
21432143
11 2 0.900 0.900 2.800
21442144
drop table t1;
2145+
#
2146+
# MDEV-9941: two window functions with compatible partitions
2147+
#
2148+
create table t1 (
2149+
a int,
2150+
b int,
2151+
c int
2152+
);
2153+
insert into t1 values
2154+
(10, 1, 1),
2155+
(10, 3, 10),
2156+
(10, 1, 10),
2157+
(10, 3, 100),
2158+
(10, 5, 1000),
2159+
(10, 1, 100);
2160+
explain format=json
2161+
select
2162+
a,b,c,
2163+
row_number() over (partition by a),
2164+
row_number() over (partition by a, b)
2165+
from t1;
2166+
EXPLAIN
2167+
{
2168+
"query_block": {
2169+
"select_id": 1,
2170+
"window_functions_computation": {
2171+
"sorts": {
2172+
"filesort": {
2173+
"sort_key": "t1.a, t1.b"
2174+
}
2175+
},
2176+
"temporary_table": {
2177+
"table": {
2178+
"table_name": "t1",
2179+
"access_type": "ALL",
2180+
"rows": 6,
2181+
"filtered": 100
2182+
}
2183+
}
2184+
}
2185+
}
2186+
}
2187+
drop table t1;

mysql-test/t/win.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,3 +1310,30 @@ select pk, a, d,
13101310
from t1;
13111311

13121312
drop table t1;
1313+
1314+
--echo #
1315+
--echo # MDEV-9941: two window functions with compatible partitions
1316+
--echo #
1317+
1318+
create table t1 (
1319+
a int,
1320+
b int,
1321+
c int
1322+
);
1323+
1324+
insert into t1 values
1325+
(10, 1, 1),
1326+
(10, 3, 10),
1327+
(10, 1, 10),
1328+
(10, 3, 100),
1329+
(10, 5, 1000),
1330+
(10, 1, 100);
1331+
1332+
explain format=json
1333+
select
1334+
a,b,c,
1335+
row_number() over (partition by a),
1336+
row_number() over (partition by a, b)
1337+
from t1;
1338+
1339+
drop table t1;

0 commit comments

Comments
 (0)