Commit e64b57a8 authored by Sergei Petrunia's avatar Sergei Petrunia

More testcases. Added .result file

parent 346c1a0a
drop table if exists t1,t2;
create table t1(a int, b int, x char(32));
insert into t1 values (2, 10, 'xx');
insert into t1 values (2, 10, 'zz');
insert into t1 values (2, 20, 'yy');
insert into t1 values (3, 10, 'xxx');
insert into t1 values (3, 20, 'vvv');
select a, row_number() over (partition by a order by b) from t1;
a row_number() over (partition by a order by b)
2 1
2 2
2 3
3 1
3 2
select a, b, x, row_number() over (partition by a order by x) from t1;
a b x row_number() over (partition by a order by x)
2 10 xx 1
2 10 zz 3
2 20 yy 2
3 10 xxx 2
3 20 vvv 1
drop table t1;
create table t1 (pk int primary key, a int, b int);
insert into t1 values
(1, 10, 22),
(2, 11, 21),
(3, 12, 20),
(4, 13, 19),
(5, 14, 18);
select
pk, a, b,
row_number() over (order by a),
row_number() over (order by b)
from t1;
pk a b row_number() over (order by a) row_number() over (order by b)
1 10 22 1 5
2 11 21 2 4
3 12 20 3 3
4 13 19 4 2
5 14 18 5 1
drop table t1;
#
# Window Functions Tests
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1(a int, b int, x char(32));
insert into t1 values (2, 10, 'xx');
insert into t1 values (2, 10, 'zz');
insert into t1 values (2, 20, 'yy');
insert into t1 values (3, 10, 'xxx');
insert into t1 values (3, 20, 'vvv');
# Uncommenting this line causes a crash in setup_group when executing the second
# select.
#select row_number() over (order by b) from t1;
#select a, b, x, row_number() over (partition by a,b order by x),
# row_number() over (partition by a),
# row_number() over (partition by a order by x)
#from t1;
# Uncommenting this line causes a crash in filesort during init_for_filesort.
#select a, b, x, row_number() over (partition by a order by x) from t1;
select a, row_number() over (partition by a order by b) from t1;
select a, b, x, row_number() over (partition by a order by x) from t1;
drop table t1;
create table t1 (pk int primary key, a int, b int);
insert into t1 values
(1, 10, 22),
(2, 11, 21),
(3, 12, 20),
(4, 13, 19),
(5, 14, 18);
select
pk, a, b,
row_number() over (order by a),
row_number() over (order by b)
from t1;
drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment