3166 Olav Sandstaa 2011-06-07
This is a re-factoring patch that is a follow-up to the fix for
Bug#11873324.
The patch for Bug#11873324 introduced a new member function called
has_guarded_conds() for the JOIN_TAB and the TABLE_REF classes. This
function checks if the JOIN_TAB/TABLE_REF has triggered/guarded
conditions. There exists other places in the optimizer code that do
this check directly. The code for some of these places can be
simplified by using the new member functions. This is implemented in
this patch by replacing this code with calls to has_guarded_conds().
This is a re-factoring patch and should have no changes to existing
behavior.
@ sql/sql_select.cc
Refactoring: simplify code that checked for triggered/guarded
condition directly by instead calling
JOIN_TAB::has_guarded_conds().
modified:
sql/sql_select.cc
3165 Ramil Kalimullin 2011-06-07 [merge]
Auto-merge from mysql-5.5
modified:
mysql-test/r/gis-rtree.result
mysql-test/t/gis-rtree.test
storage/myisam/mi_update.c
storage/myisam/mi_write.c
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-06-06 12:49:55 +0000
+++ b/sql/sql_select.cc 2011-06-07 16:28:07 +0000
@@ -1270,14 +1270,8 @@ static void save_index_subquery_explain_
join_tab->packed_info |= TAB_INFO_USING_INDEX;
if (where)
join_tab->packed_info |= TAB_INFO_USING_WHERE;
- for (uint i = 0; i < join_tab->ref.key_parts; i++)
- {
- if (join_tab->ref.cond_guards[i])
- {
- join_tab->packed_info |= TAB_INFO_FULL_SCAN_ON_NULL;
- break;
- }
- }
+ if (join_tab->has_guarded_conds())
+ join_tab->packed_info|= TAB_INFO_FULL_SCAN_ON_NULL;
}
@@ -19722,27 +19716,23 @@ static Item *
part_of_refkey(TABLE *table,Field *field)
{
if (!table->reginfo.join_tab)
- return (Item*) 0; // field from outer non-select (UPDATE,...)
+ return NULL; // field from outer non-select (UPDATE,...)
uint ref_parts=table->reginfo.join_tab->ref.key_parts;
if (ref_parts)
{
- KEY_PART_INFO *key_part=
- table->key_info[table->reginfo.join_tab->ref.key].key_part;
- uint part;
+ if (table->reginfo.join_tab->has_guarded_conds())
+ return NULL;
- for (part=0 ; part < ref_parts ; part++)
- {
- if (table->reginfo.join_tab->ref.cond_guards[part])
- return 0;
- }
+ const KEY_PART_INFO *key_part=
+ table->key_info[table->reginfo.join_tab->ref.key].key_part;
- for (part=0 ; part < ref_parts ; part++,key_part++)
+ for (uint part=0 ; part < ref_parts ; part++,key_part++)
if (field->eq(key_part->field) &&
!(key_part->key_part_flag & HA_PART_KEY_SEG))
return table->reginfo.join_tab->ref.items[part];
}
- return (Item*) 0;
+ return NULL;
}
@@ -23479,14 +23469,8 @@ void select_describe(JOIN *join, bool ne
extra.append(STRING_WITH_LEN("; End materialize"));
}
- for (uint part= 0; part < tab->ref.key_parts; part++)
- {
- if (tab->ref.cond_guards[part])
- {
- extra.append(STRING_WITH_LEN("; Full scan on NULL key"));
- break;
- }
- }
+ if (tab->has_guarded_conds())
+ extra.append(STRING_WITH_LEN("; Full scan on NULL key"));
if (i > 0 && tab[-1].next_select == sub_select_cache)
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (olav.sandstaa:3165 to 3166) Bug#11873324 | Olav Sandstaa | 7 Jun |