oceanbase
211 строк · 11.1 Кб
1# owner: yibo.tyf
2# owner group: SQL3
3# tags: optimizer
4
5--source mysql_test/test_suite/executor/include/cleanup.inc
6--source mysql_test/test_suite/executor/include/load_data.inc
7
8--result_format 4
9--explain_protocol 2
10--disable_abort_on_error
11
12################################
13# basic
14# all kinds of receive.
15
16# fifo receive
17select b, sum(a) from t_h3_01_20 group by b having sum(a) between 5 and 16 order by b;
18select b, sum(a) from t_h5_09_28 group by b having sum(a) between 13 and 24 order by b desc;
19select b, sum(a) from t_r4_01_20 group by b having sum(a) between 5 and 16 order by b;
20select b, sum(a) from t_r5_09_28 group by b having sum(a) between 13 and 24 order by b desc;
21select b, sum(a) from t_h3_r4_01_20 group by b having sum(a) between 5 and 16 order by b;
22select b, sum(a) from t_h3_r5_09_28 group by b having sum(a) between 13 and 24 order by b desc;
23select b, sum(a) from t_h5_r4_01_20 group by b having sum(a) between 5 and 16 order by b;
24select b, sum(a) from t_h5_r5_09_28 group by b having sum(a) between 13 and 24 order by b desc;
25# task order receive
26select a, b from t_r4_01_20 where a between 5 and 16 order by a;
27select a, b from t_r4_09_28 where a between 13 and 24 order by a desc;
28select a, b from t_r5_01_20 where a between 5 and 16 order by a;
29select a, b from t_r5_09_28 where a between 13 and 24 order by a desc;
30select a, b from t_h3_r4_01_20 where a = 12 order by b;
31select a, b from t_h3_r5_09_28 where a = 12 order by b desc;
32select a, b from t_h5_r4_01_20 where a = 12 order by b;
33select a, b from t_h5_r5_09_28 where a = 12 order by b desc;
34# merge sort receive
35select a, b from t_h3_01_20 where a between 5 and 16 order by b;
36select a, b from t_h5_09_28 where a between 13 and 24 order by b desc;
37select a, b from t_r4_01_20 where a between 5 and 16 order by b;
38select a, b from t_r4_09_28 where a between 13 and 24 order by b desc;
39select a, b from t_h3_r4_01_20 where a between 5 and 16 order by b;
40select a, b from t_h3_r5_09_28 where a between 13 and 24 order by b desc;
41select a, b from t_h5_r4_01_20 where a between 5 and 16 order by b;
42select a, b from t_h5_r5_09_28 where a between 13 and 24 order by b desc;
43
44## check if result_type_classes of join_keys are the same when repart
45select * from t_h5_int t1, t_refered as t2 where t1.a = t2.aa;
46select * from t_h5_int t1, t_refered as t2 where t1.a = t2.a;
47select * from t_h5_int t1, t_refered as t2 where t1.a = t2.b;
48select * from t_h5_int t1, t_refered as t2 where t1.a = t2.c;
49select * from t_h5_int t1, t_refered as t2 where t1.a = t2.d;
50select * from t_h5_int t1, t_refered as t2 where t1.a = t2.e;
51
52
53select * from t_r4_int t1, t_refered as t2 where t1.a = t2.aa;
54select * from t_r4_int t1, t_refered as t2 where t1.a = t2.a;
55select * from t_r4_int t1, t_refered as t2 where t1.a = t2.b;
56select * from t_r4_int t1, t_refered as t2 where t1.a = t2.c;
57select * from t_r4_int t1, t_refered as t2 where t1.a = t2.d;
58select * from t_r4_int t1, t_refered as t2 where t1.a = t2.e;
59
60select * from t_r4_date t1, t_refered as t2 where t1.c = t2.a;
61select * from t_r4_date t1, t_refered as t2 where t1.c = t2.b;
62--sorted_result
63select * from t_r4_date t1, t_refered as t2 where t1.c = t2.c;
64--sorted_result
65select * from t_r4_date t1, t_refered as t2 where t1.c = t2.d;
66select * from t_r4_date t1, t_refered as t2 where t1.c = t2.e;
67
68select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.a;
69select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.b;
70--sorted_result
71select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.c;
72--sorted_result
73select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.d;
74select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.e;
75
76#bug:
77select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.a;
78select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.aa;
79select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.b;
80select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.bb;
81select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.c;
82select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.d;
83select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.e;
84
85
86select * from t_r4_int t1, t_r4_int as t2 where t1.a = t2.a;
87select * from t_r4_int t1, t_r4_date as t2 where t1.a = t2.c;
88select * from t_r4_int t1, t_r4_datetime as t2 where t1.a = t2.c;
89select * from t_r4_int t1, t_r4_timestamp as t2 where t1.a = t2.c;
90
91
92select * from t_r4_date t1, t_r4_int as t2 where t1.c = t2.a;
93select * from t_r4_date t1, t_r4_date as t2 where t1.c = t2.c;
94select * from t_r4_date t1, t_r4_datetime as t2 where t1.c = t2.c;
95select * from t_r4_date t1, t_r4_timestamp as t2 where t1.c = t2.c;
96
97select * from t_r4_datetime t1, t_r4_int as t2 where t1.c = t2.a;
98select * from t_r4_datetime t1, t_r4_date as t2 where t1.c = t2.c;
99select * from t_r4_datetime t1, t_r4_datetime as t2 where t1.c = t2.c;
100select * from t_r4_datetime t1, t_r4_timestamp as t2 where t1.c = t2.c;
101
102select * from t_h5_int t1, t_refered as t2 where t1.a = t2.aa;
103select * from t_h5_int t1, t_refered as t2 where t1.a = t2.a;
104select * from t_h5_int t1, t_refered as t2 where t1.a = t2.b;
105select * from t_h5_int t1, t_refered as t2 where t1.a = t2.c;
106select * from t_h5_int t1, t_refered as t2 where t1.a = t2.d;
107select * from t_h5_int t1, t_refered as t2 where t1.a = t2.e;
108
109select * from t_r4_int t1, t_refered as t2 where t1.a = t2.aa;
110select * from t_r4_int t1, t_refered as t2 where t1.a = t2.a;
111select * from t_r4_int t1, t_refered as t2 where t1.a = t2.b;
112select * from t_r4_int t1, t_refered as t2 where t1.a = t2.c;
113select * from t_r4_int t1, t_refered as t2 where t1.a = t2.d;
114select * from t_r4_int t1, t_refered as t2 where t1.a = t2.e;
115
116select * from t_r4_date t1, t_refered as t2 where t1.c = t2.a;
117select * from t_r4_date t1, t_refered as t2 where t1.c = t2.b;
118--sorted_result
119select * from t_r4_date t1, t_refered as t2 where t1.c = t2.c;
120--sorted_result
121select * from t_r4_date t1, t_refered as t2 where t1.c = t2.d;
122select * from t_r4_date t1, t_refered as t2 where t1.c = t2.e;
123
124select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.a;
125select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.b;
126--sorted_result
127select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.c;
128--sorted_result
129select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.d;
130select * from t_r4_datetime t1, t_refered as t2 where t1.c = t2.e;
131
132select * from t_h5_r4_int_int t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a;
133select * from t_h5_r4_int_int t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.aa;
134select * from t_h5_r4_int_int t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.b;
135select * from t_h5_r4_int_int t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.c;
136select * from t_h5_r4_int_int t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.d;
137select * from t_h5_r4_int_int t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.e;
138
139select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.a;
140select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.aa;
141select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.b;
142select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.bb;
143select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.c;
144select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.d;
145select * from t_h5_r4_int_int_datetime t1, t_refered as t2 where t1.a = t2.a and t1.b=t2.a and t1.c = t2.e;
146
147select * from t_r4_int t1, t_r4_int as t2 where t1.a = t2.a;
148select * from t_r4_int t1, t_r4_date as t2 where t1.a = t2.c;
149select * from t_r4_int t1, t_r4_datetime as t2 where t1.a = t2.c;
150select * from t_r4_int t1, t_r4_timestamp as t2 where t1.a = t2.c;
151
152
153select * from t_r4_date t1, t_r4_int as t2 where t1.c = t2.a;
154select * from t_r4_date t1, t_r4_date as t2 where t1.c = t2.c;
155select * from t_r4_date t1, t_r4_datetime as t2 where t1.c = t2.c;
156select * from t_r4_date t1, t_r4_timestamp as t2 where t1.c = t2.c;
157
158select * from t_r4_datetime t1, t_r4_int as t2 where t1.c = t2.a;
159select * from t_r4_datetime t1, t_r4_date as t2 where t1.c = t2.c;
160select * from t_r4_datetime t1, t_r4_datetime as t2 where t1.c = t2.c;
161select * from t_r4_datetime t1, t_r4_timestamp as t2 where t1.c = t2.c;
162
163
164# additional case for task order with many range part.
165
166select min(a) from t_many_range_part where a >= 1;
167select min(a) from t_many_range_part where a >= 6;
168select min(a) from t_many_range_part where a >= 11;
169select min(a) from t_many_range_part where a >= 16;
170select min(a) from t_many_range_part where a >= 21;
171select min(a) from t_many_range_part where a >= 26;
172select min(a) from t_many_range_part where a >= 31;
173select min(a) from t_many_range_part where a >= 36;
174select min(a) from t_many_range_part where a >= 41;
175select min(a) from t_many_range_part where a >= 46;
176
177select max(a) from t_many_range_part where a >= 1;
178select max(a) from t_many_range_part where a >= 6;
179select max(a) from t_many_range_part where a >= 11;
180select max(a) from t_many_range_part where a >= 16;
181select max(a) from t_many_range_part where a >= 21;
182select max(a) from t_many_range_part where a >= 26;
183select max(a) from t_many_range_part where a >= 31;
184select max(a) from t_many_range_part where a >= 36;
185select max(a) from t_many_range_part where a >= 41;
186select max(a) from t_many_range_part where a >= 46;
187
188select a from t_many_range_part where a >= 1 order by a asc limit 10;
189select a from t_many_range_part where a >= 6 order by a asc limit 10;
190select a from t_many_range_part where a >= 11 order by a asc limit 10;
191select a from t_many_range_part where a >= 16 order by a asc limit 10;
192select a from t_many_range_part where a >= 21 order by a asc limit 10;
193select a from t_many_range_part where a >= 26 order by a asc limit 10;
194select a from t_many_range_part where a >= 31 order by a asc limit 10;
195select a from t_many_range_part where a >= 36 order by a asc limit 10;
196select a from t_many_range_part where a >= 41 order by a asc limit 10;
197select a from t_many_range_part where a >= 46 order by a asc limit 10;
198
199select a from t_many_range_part where a >= 1 order by a desc limit 10;
200select a from t_many_range_part where a >= 6 order by a desc limit 10;
201select a from t_many_range_part where a >= 11 order by a desc limit 10;
202select a from t_many_range_part where a >= 16 order by a desc limit 10;
203select a from t_many_range_part where a >= 21 order by a desc limit 10;
204select a from t_many_range_part where a >= 26 order by a desc limit 10;
205select a from t_many_range_part where a >= 31 order by a desc limit 10;
206select a from t_many_range_part where a >= 36 order by a desc limit 10;
207select a from t_many_range_part where a >= 41 order by a desc limit 10;
208select a from t_many_range_part where a >= 46 order by a desc limit 10;
209
210
211--source mysql_test/test_suite/executor/include/cleanup.inc
212