List:Commits« Previous MessageNext Message »
From:Olav Sandstaa Date:May 15 2011 9:07pm
Subject:bzr commit into mysql-trunk branch (olav.sandstaa:3086) Bug#11873324
View as plain text  
#At file:///home/olav/mysql/develop/guarded-conds-ref/ based on revid:vinay.fisrekar@stripped

 3086 Olav Sandstaa	2011-05-15
      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
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-05-06 12:56:36 +0000
+++ b/sql/sql_select.cc	2011-05-15 21:07:24 +0000
@@ -1271,14 +1271,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;
 }
 
 
@@ -19703,17 +19697,13 @@ part_of_refkey(TABLE *table,Field *field
   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];
@@ -23455,14 +23445,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)
         {


Attachment: [text/bzr-bundle] bzr/olav.sandstaa@oracle.com-20110515210724-dc3bhzjx0qkyroys.bundle
Thread
bzr commit into mysql-trunk branch (olav.sandstaa:3086) Bug#11873324Olav Sandstaa15 May