Skip to content

Commit eb54d86

Browse files
committed
MDEV-10700: 10.2.2 windowing function returns incorrect result
This bug is fixed by MDEV-10092. Add test case to check for regressions.
1 parent d06a44e commit eb54d86

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

mysql-test/r/win.result

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,3 +3049,29 @@ select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC;
30493049
ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function'
30503050
drop table TDEC;
30513051
drop view VDEC;
3052+
#
3053+
# MDEV-10700: 10.2.2 windowing function returns incorrect result
3054+
#
3055+
create table t(a int,b int, c int , d int);
3056+
insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
3057+
insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
3058+
replace into t(a,b,c,d) select 1, rand(10)*1000, rand(10)*1000, rand(10)*1000 from t t1, t t2, t t3, t t4, t t5, t t6, t t7, t t8, t t9, t t10, t t11, t t12, t t13, t t14, t t15, t t16, t t17;
3059+
select count(distinct s) from (select sum(d) over(partition by a,b,c) as s from t) Z where s > 0;
3060+
count(distinct s)
3061+
993
3062+
select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0;
3063+
count(distinct s)
3064+
993
3065+
select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0;
3066+
count(distinct s)
3067+
993
3068+
select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0;
3069+
count(distinct s)
3070+
993
3071+
select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0;
3072+
count(distinct s)
3073+
1
3074+
select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0;
3075+
count(distinct s)
3076+
1
3077+
drop table t;

mysql-test/t/win.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,3 +1774,22 @@ select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC;
17741774

17751775
drop table TDEC;
17761776
drop view VDEC;
1777+
1778+
--echo #
1779+
--echo # MDEV-10700: 10.2.2 windowing function returns incorrect result
1780+
--echo #
1781+
create table t(a int,b int, c int , d int);
1782+
insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
1783+
insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
1784+
replace into t(a,b,c,d) select 1, rand(10)*1000, rand(10)*1000, rand(10)*1000 from t t1, t t2, t t3, t t4, t t5, t t6, t t7, t t8, t t9, t t10, t t11, t t12, t t13, t t14, t t15, t t16, t t17;
1785+
1786+
select count(distinct s) from (select sum(d) over(partition by a,b,c) as s from t) Z where s > 0;
1787+
select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0;
1788+
1789+
select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0;
1790+
select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0;
1791+
1792+
select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0;
1793+
select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0;
1794+
1795+
drop table t;

0 commit comments

Comments
 (0)