Commit f5ecf708 authored by unknown's avatar unknown

Fixed LP bug #608744

The bug is a result of the following change by Monty:
  Revision Id: monty@askmonty.org-20100716073301-gstby2062nqd42qv
  Timestamp: Fri 2010-07-16 10:33:01 +0300
Where Monty changed the queues interface and implementation.

The fix adjusts the queue_remove call to the new interface.


mysql-test/r/subselect_partial_match.result:
  Added new file for tests related to MWL#89.
mysql-test/t/subselect_partial_match.test:
  Added new file for tests related to MWL#89.
parent a81f7515
drop table if exists t1, t2;
#launchpad BUG#608744
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=off";
create table t1 (a1 char(1), a2 char(1));
insert into t1 values (NULL, 'b');
create table t2 (b1 char(1), b2 char(2));
insert into t2 values ('a','b'), ('c', 'd');
select * from t1 where (a1, a2) NOT IN (select b1, b2 from t2);
a1 a2
drop table t1,t2;
set @@optimizer_switch=@save_optimizer_switch;
#
# Tests for
# MWL#68: Subquery optimization: Efficient NOT IN execution with NULLs
#
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
#
--echo #launchpad BUG#608744
#
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=off";
create table t1 (a1 char(1), a2 char(1));
insert into t1 values (NULL, 'b');
create table t2 (b1 char(1), b2 char(2));
insert into t2 values ('a','b'), ('c', 'd');
select * from t1 where (a1, a2) NOT IN (select b1, b2 from t2);
drop table t1,t2;
set @@optimizer_switch=@save_optimizer_switch;
...@@ -4992,6 +4992,8 @@ bool subselect_rowid_merge_engine::partial_match() ...@@ -4992,6 +4992,8 @@ bool subselect_rowid_merge_engine::partial_match()
/* If there is a non-NULL key, it must be the first key in the keys array. */ /* If there is a non-NULL key, it must be the first key in the keys array. */
DBUG_ASSERT(!non_null_key || (non_null_key && merge_keys[0] == non_null_key)); DBUG_ASSERT(!non_null_key || (non_null_key && merge_keys[0] == non_null_key));
/* The prioryty queue for keys must be empty. */
DBUG_ASSERT(!pq.elements);
/* All data accesses during execution are via handler::ha_rnd_pos() */ /* All data accesses during execution are via handler::ha_rnd_pos() */
tmp_table->file->ha_rnd_init(0); tmp_table->file->ha_rnd_init(0);
...@@ -5056,7 +5058,7 @@ bool subselect_rowid_merge_engine::partial_match() ...@@ -5056,7 +5058,7 @@ bool subselect_rowid_merge_engine::partial_match()
DBUG_ASSERT(pq.elements); DBUG_ASSERT(pq.elements);
min_key= (Ordered_key*) queue_remove(&pq, 0); min_key= (Ordered_key*) queue_remove_top(&pq);
min_row_num= min_key->current(); min_row_num= min_key->current();
bitmap_copy(&matching_keys, &null_only_columns); bitmap_copy(&matching_keys, &null_only_columns);
bitmap_set_bit(&matching_keys, min_key->get_keyid()); bitmap_set_bit(&matching_keys, min_key->get_keyid());
...@@ -5076,7 +5078,7 @@ bool subselect_rowid_merge_engine::partial_match() ...@@ -5076,7 +5078,7 @@ bool subselect_rowid_merge_engine::partial_match()
while (TRUE) while (TRUE)
{ {
cur_key= (Ordered_key*) queue_remove(&pq, 0); cur_key= (Ordered_key*) queue_remove_top(&pq);
cur_row_num= cur_key->current(); cur_row_num= cur_key->current();
if (cur_row_num == min_row_num) if (cur_row_num == min_row_num)
...@@ -5115,6 +5117,7 @@ bool subselect_rowid_merge_engine::partial_match() ...@@ -5115,6 +5117,7 @@ bool subselect_rowid_merge_engine::partial_match()
DBUG_ASSERT(FALSE); DBUG_ASSERT(FALSE);
end: end:
queue_remove_all(&pq);
tmp_table->file->ha_rnd_end(); tmp_table->file->ha_rnd_end();
return res; return res;
} }
......
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