[Commits] Rev 3480: Better comments in file:///data0/psergey/dev2/10.0-exists2in/

Sergey Petrunya psergey at askmonty.org
Fri Nov 23 08:36:40 EET 2012


At file:///data0/psergey/dev2/10.0-exists2in/

------------------------------------------------------------
revno: 3480
revision-id: psergey at askmonty.org-20121123063639-i3ghspaowl8tjnte
parent: sanja at montyprogram.com-20121112201416-m8f003hqeci2w070
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 10.0-exists2in
timestamp: Fri 2012-11-23 10:36:39 +0400
message:
  Better comments
=== modified file 'sql/item.h'
--- a/sql/item.h	2012-11-12 20:14:16 +0000
+++ b/sql/item.h	2012-11-23 06:36:39 +0000
@@ -1500,7 +1500,7 @@
   virtual uint exists2in_reserved_items() { return 0; };
 
   /**
-    Registers this item lying under the NOT item
+    Inform the item that it is located under a NOT, which is a top-level item.
   */
   virtual void under_not(Item_func_not * upper
                          __attribute__((unused))) {};

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2012-11-12 20:14:16 +0000
+++ b/sql/item_cmpfunc.cc	2012-11-23 06:36:39 +0000
@@ -1523,11 +1523,19 @@
 }
 
 /**
-  Check if Item_in_optimizer should not be involved in result calculation
-  (subquery should provide final result)
-
-  @note in case of real EXISTS or optimized MAX/MIN subquery result
-  should be just passed untouched from subquery to upper level.
+  Check if Item_in_optimizer should work as a pass-through item for its 
+  arguments.
+
+  @note 
+   Item_in_optimizer should work as pass-through for
+    - subqueries that were processed by ALL/ANY->MIN/MAX rewrite
+    - subqueries taht were originally EXISTS subqueries (and were coverted by
+      the EXISTS->IN rewrite)
+
+   When Item_in_optimizer is not not working as a pass-through, it
+    - caches its "left argument", args[0].
+    - makes adjustments to subquery item's return value for proper NULL
+      value handling
 */
 
 bool Item_in_optimizer::invisible_mode()
@@ -1538,6 +1546,7 @@
          Item_subselect::EXISTS_SUBS);
 }
 
+
 /**
   Add an expression cache for this subquery if it is needed
 

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2012-11-12 20:14:16 +0000
+++ b/sql/item_subselect.cc	2012-11-23 06:36:39 +0000
@@ -2517,8 +2517,13 @@
 }
 
 
-bool
-Item_exists_subselect::select_prepare_to_be_in()
+/*
+  If this select can potentially be converted by EXISTS->IN conversion, wrap it
+  in an Item_in_optimizer object. Final decision whether to do the conversion
+  is done at a later phase.
+*/
+
+bool Item_exists_subselect::select_prepare_to_be_in()
 {
   bool trans_res= FALSE;
   DBUG_ENTER("Item_exists_subselect::select_prepare_to_be_in");
@@ -2591,7 +2596,7 @@
 
 
 /**
-  Check if 'conds' has
+  Check if 'conds' is a set of AND-ed outer_expr=inner_table.col equalities
 
   @detail
     Check if 'conds' has form

=== modified file 'sql/opt_subselect.cc'
--- a/sql/opt_subselect.cc	2012-11-12 20:14:16 +0000
+++ b/sql/opt_subselect.cc	2012-11-23 06:36:39 +0000
@@ -595,13 +595,9 @@
   if (!thd->lex->is_view_context_analysis() &&          // (1)
       (subselect= parent_unit->item))                   // (2)
   {
-    //Item_exists_subselect *exists_subs= NULL;
     Item_in_subselect *in_subs= NULL;
     Item_allany_subselect *allany_subs= NULL;
     switch (subselect->substype()) {
-    case Item_subselect::EXISTS_SUBS:
-      //exists_subs= (Item_exists_subselect *)subselect;
-      break;
     case Item_subselect::IN_SUBS:
       in_subs= (Item_in_subselect *)subselect;
       break;



More information about the commits mailing list