Skip to content

Commit ccce4d3

Browse files
committed
MDEV-16188 Post review fixes
Also adjusted some test files.
1 parent e1de23b commit ccce4d3

11 files changed

+39
-34
lines changed

mysql-test/include/icp_tests.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ EXPLAIN
226226
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2;
227227
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' and i1 > 2;
228228

229+
--replace_column 9 100
229230
EXPLAIN
230231
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2;
231232
SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2;

mysql-test/include/index_merge1.inc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ create table t2(
479479
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
480480
insert into t2 select * from t1;
481481

482+
482483
--echo must use sort-union rather than union:
483484
--replace_column 9 #
484485
explain select * from t1 where a=4 or b=4;
@@ -489,9 +490,9 @@ select * from t1 ignore index(a,b) where a=4 or b=4;
489490

490491
--echo must use union, not sort-union:
491492
--replace_column 9 #
492-
explain select * from t2 where a=4 or b=4;
493+
explain select * from t2 where a=2 or b=2;
493494
--sorted_result
494-
select * from t2 where a=4 or b=4;
495+
select * from t2 where a=2 or b=2;
495496

496497
drop table t1, t2;
497498

mysql-test/main/index_merge_myisam.result

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -522,18 +522,13 @@ a filler b
522522
4 zz 4
523523
5 qq 4
524524
must use union, not sort-union:
525-
explain select * from t2 where a=4 or b=4;
525+
explain select * from t2 where a=2 or b=2;
526526
id select_type table type possible_keys key key_len ref rows Extra
527-
1 SIMPLE t2 ALL a,b NULL NULL NULL # Using where
528-
select * from t2 where a=4 or b=4;
527+
1 SIMPLE t2 index_merge a,b a,b 5,5 NULL # Using union(a,b); Using where
528+
select * from t2 where a=2 or b=2;
529529
a filler b
530-
4 4 0
531-
4 5 0
532-
4 filler 4
533-
4 filler 4
534-
4 qq 5
535-
4 zz 4
536-
5 qq 4
530+
2 filler 2
531+
2 filler 2
537532
drop table t1, t2;
538533
CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
539534
KEY b(b), KEY a(a));

mysql-test/main/innodb_ext_key.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,8 @@ set optimizer_switch='extended_keys=off';
824824
explain
825825
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
826826
id select_type table type possible_keys key key_len ref rows Extra
827-
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
828-
1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
827+
1 SIMPLE t1 ALL NULL NULL NULL NULL #
828+
1 SIMPLE t2 eq_ref a a 4 test.t1.a # Using where
829829
flush status;
830830
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
831831
a pk a b
@@ -846,8 +846,8 @@ set optimizer_switch='extended_keys=on';
846846
explain
847847
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
848848
id select_type table type possible_keys key key_len ref rows Extra
849-
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
850-
1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
849+
1 SIMPLE t1 ALL NULL NULL NULL NULL #
850+
1 SIMPLE t2 eq_ref a a 4 test.t1.a # Using where
851851
flush status;
852852
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
853853
a pk a b

mysql-test/main/innodb_ext_key.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,15 @@ select
497497
from t1 A, t1 B;
498498

499499
set optimizer_switch='extended_keys=off';
500+
--replace_column 9 #
500501
explain
501502
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
502503
flush status;
503504
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
504505
show status like 'handler_read%';
505506

506507
set optimizer_switch='extended_keys=on';
508+
--replace_column 9 #
507509
explain
508510
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
509511
flush status;

mysql-test/main/subselect_sj2.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,10 +815,10 @@ explain
815815
SELECT * FROM t3
816816
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
817817
id select_type table type possible_keys key key_len ref rows Extra
818-
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const 1 Using index
819-
1 PRIMARY alias2 index f12 f12 7 NULL 1 Using index; LooseScan
820-
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; FirstMatch(alias2)
821-
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 Using where; Using join buffer (flat, BNL join)
818+
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
819+
1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
820+
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
821+
1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
822822
SELECT * FROM t3
823823
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
824824
f12

mysql-test/main/subselect_sj2.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,8 @@ CREATE TABLE t3 (f12 varchar(1) NOT NULL) ENGINE=InnoDB;
995995
INSERT INTO t3 VALUES ('r'),('s'),('t'),('v'),('w'),('x'),('y');
996996

997997
--echo # The following must use LooseScan but not join buffering
998+
999+
--replace_column 9 #
9981000
explain
9991001
SELECT * FROM t3
10001002
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);

mysql-test/main/subselect_sj2_jcl6.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,10 @@ explain
831831
SELECT * FROM t3
832832
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
833833
id select_type table type possible_keys key key_len ref rows Extra
834-
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const 1 Using index
835-
1 PRIMARY alias2 index f12 f12 7 NULL 1 Using index; LooseScan
836-
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; FirstMatch(alias2)
837-
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 Using where; Using join buffer (flat, BNL join)
834+
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
835+
1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
836+
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
837+
1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
838838
SELECT * FROM t3
839839
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
840840
f12

mysql-test/main/subselect_sj2_mat.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,10 @@ explain
817817
SELECT * FROM t3
818818
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
819819
id select_type table type possible_keys key key_len ref rows Extra
820-
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const 1 Using index
821-
1 PRIMARY alias2 index f12 f12 7 NULL 1 Using index; LooseScan
822-
1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; FirstMatch(alias2)
823-
1 PRIMARY t3 ALL NULL NULL NULL NULL 7 Using where; Using join buffer (flat, BNL join)
820+
1 PRIMARY alias1 const PRIMARY PRIMARY 4 const # Using index
821+
1 PRIMARY alias2 index f12 f12 7 NULL # Using index; LooseScan
822+
1 PRIMARY t1 index NULL PRIMARY 4 NULL # Using index; FirstMatch(alias2)
823+
1 PRIMARY t3 ALL NULL NULL NULL NULL # Using where; Using join buffer (flat, BNL join)
824824
SELECT * FROM t3
825825
WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
826826
f12

sql/rowid_filter.cc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ int compare_range_rowid_filter_cost_info_by_a(
189189

190190
void TABLE::prune_range_rowid_filters()
191191
{
192-
uint i, j;
193-
194192
/*
195193
For the elements of the array with cost info on range filters
196194
build a bit matrix of absolutely independent elements.
@@ -201,11 +199,15 @@ void TABLE::prune_range_rowid_filters()
201199
*/
202200

203201
Range_rowid_filter_cost_info **filter_ptr_1= range_rowid_filter_cost_info_ptr;
204-
for (i= 0; i < range_rowid_filter_cost_info_elems; i++, filter_ptr_1++)
202+
for (uint i= 0;
203+
i < range_rowid_filter_cost_info_elems;
204+
i++, filter_ptr_1++)
205205
{
206206
uint key_no= (*filter_ptr_1)->key_no;
207207
Range_rowid_filter_cost_info **filter_ptr_2= filter_ptr_1 + 1;
208-
for (j= i+1; j < range_rowid_filter_cost_info_elems; j++, filter_ptr_2++)
208+
for (uint j= i+1;
209+
j < range_rowid_filter_cost_info_elems;
210+
j++, filter_ptr_2++)
209211
{
210212
key_map map_1= key_info[key_no].overlapped;
211213
map_1.merge(key_info[key_no].constraint_correlated);
@@ -236,7 +238,9 @@ void TABLE::prune_range_rowid_filters()
236238

237239
Range_rowid_filter_cost_info **cand_filter_ptr=
238240
range_rowid_filter_cost_info_ptr;
239-
for (i= 0; i < range_rowid_filter_cost_info_elems; i++, cand_filter_ptr++)
241+
for (uint i= 0;
242+
i < range_rowid_filter_cost_info_elems;
243+
i++, cand_filter_ptr++)
240244
{
241245
bool is_pruned= false;
242246
Range_rowid_filter_cost_info **usable_filter_ptr=

0 commit comments

Comments
 (0)