1SET DEFAULT_STORAGE_ENGINE='tokudb';
2*** Bug #22169 ***
3DROP TABLE IF EXISTS z1;
4create table z1 (a int, b int, c int, d int, e int, primary key (c,d), key (a,b) clustering=yes);
5insert into z1 values (1,1,1,1,1), (1,2,3,4,5), (3,4,1,100,1),(3,4,1,2,3),(3,5,1,21,1),(7,8,4,2,6),(9,10,34,3,2);
6insert into z1 values (-1,-1,-1,-1,-1), (-1,-2,-3,-4,-5), (-3,-4,-1,-100,-1),(-3,-4,-1,-2,-3),(-3,-5,-1,-21,-1),(-7,-8,-4,-2,-6),(-9,-10,-34,-3,-2);
7select * from z1 group by a,b;
8a	b	c	d	e
9-9	-10	-34	-3	-2
10-7	-8	-4	-2	-6
11-3	-5	-1	-21	-1
12-3	-4	-1	-100	-1
13-1	-2	-3	-4	-5
14-1	-1	-1	-1	-1
151	1	1	1	1
161	2	3	4	5
173	4	1	2	3
183	5	1	21	1
197	8	4	2	6
209	10	34	3	2
21explain select a,b from z1 where a > 1;
22id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
231	SIMPLE	z1	range	a	a	5	NULL	5	Using where; Using index
24select a,b from z1 where a > 1;
25a	b
263	4
273	4
283	5
297	8
309	10
31explain select a,b from z1 where a >=1 and b > 1;
32id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
331	SIMPLE	z1	range	a	a	10	NULL	6	Using where; Using index
34select a,b from z1 where a >=1 and b > 1;
35a	b
361	2
373	4
383	4
393	5
407	8
419	10
42explain select a,b from z1 where a > 3;
43id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
441	SIMPLE	z1	range	a	a	5	NULL	2	Using where; Using index
45select a,b from z1 where a > 3;
46a	b
477	8
489	10
49explain select a,b from z1 where a >=3 and b > 4;
50id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
511	SIMPLE	z1	range	a	a	10	NULL	3	Using where; Using index
52select a,b from z1 where a >=3 and b > 4;
53a	b
543	5
557	8
569	10
57select distinct a from z1;
58a
59-9
60-7
61-3
62-1
631
643
657
669
67DROP TABLE z1;
68