Skip to content

Commit e261c14

Browse files
committed
Add a testcase for RANGE-type frames and NULL values
1 parent a0c06ba commit e261c14

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

mysql-test/r/win.result

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,3 +1086,35 @@ and 0.1 following)
10861086
1.220 2
10871087
3.330 1
10881088
drop table t1;
1089+
#
1090+
# RANGE-type frames and NULL values
1091+
#
1092+
create table t1 (
1093+
pk int,
1094+
a int,
1095+
b int
1096+
);
1097+
insert into t1 values (1, NULL,1);
1098+
insert into t1 values (2, NULL,1);
1099+
insert into t1 values (3, NULL,1);
1100+
insert into t1 values (4, 10 ,1);
1101+
insert into t1 values (5, 11 ,1);
1102+
insert into t1 values (6, 12 ,1);
1103+
insert into t1 values (7, 13 ,1);
1104+
insert into t1 values (8, 14 ,1);
1105+
select
1106+
pk, a,
1107+
count(b) over (order by a
1108+
range between 2 preceding
1109+
and 2 following) as CNT
1110+
from t1;
1111+
pk a CNT
1112+
1 NULL 3
1113+
2 NULL 3
1114+
3 NULL 3
1115+
4 10 3
1116+
5 11 4
1117+
6 12 5
1118+
7 13 4
1119+
8 14 3
1120+
drop table t1;

mysql-test/t/win.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,3 +637,30 @@ select
637637
from t1;
638638

639639
drop table t1;
640+
641+
--echo #
642+
--echo # RANGE-type frames and NULL values
643+
--echo #
644+
create table t1 (
645+
pk int,
646+
a int,
647+
b int
648+
);
649+
650+
insert into t1 values (1, NULL,1);
651+
insert into t1 values (2, NULL,1);
652+
insert into t1 values (3, NULL,1);
653+
insert into t1 values (4, 10 ,1);
654+
insert into t1 values (5, 11 ,1);
655+
insert into t1 values (6, 12 ,1);
656+
insert into t1 values (7, 13 ,1);
657+
insert into t1 values (8, 14 ,1);
658+
659+
660+
select
661+
pk, a,
662+
count(b) over (order by a
663+
range between 2 preceding
664+
and 2 following) as CNT
665+
from t1;
666+
drop table t1;

0 commit comments

Comments
 (0)