List:Internals« Previous MessageNext Message »
From:Alex Ivanov Date:September 7 2005 3:43pm
Subject:bk commit into 5.0 tree (aivanov:1.1968)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alexi. When alexi does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1968 05/09/07 17:42:47 aivanov@stripped +5 -0
  join_outer.result, opt_range.cc, item_cmpfunc.cc:
    Post merge changes
  sql_yacc.yy:
    Post merge changes
  sql_select.cc:
    Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
     for some expressions (post merge changes).
     The function add_key_fields() is modified. There cannot be NOT before
     BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
     now [NOT]BETWEEN/IN expressions.

  mysql-test/r/join_outer.result
    1.44 05/09/07 17:35:38 aivanov@stripped +5 -5
    Post merge changes

  sql/sql_yacc.yy
    1.418 05/09/07 17:34:27 aivanov@stripped +8 -8
    Post merge changes.

  sql/sql_select.cc
    1.366 05/09/07 17:29:36 aivanov@stripped +0 -13
    Fixed bugs #12101, #12102: wrong calculation of not_null_tables()
     for some expressions (post merge changes).
     The function add_key_fields() is modified. There cannot be NOT before
     BETWEEN/IN anymore. Rather Item_func_between/in objects can represent
     now [NOT]BETWEEN/IN expressions.

  sql/opt_range.cc
    1.187 05/09/07 17:29:04 aivanov@stripped +4 -12
    Post merge changes

  sql/item_cmpfunc.cc
    1.173 05/09/07 17:26:12 aivanov@stripped +8 -8
    Post merge changes

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	aivanov
# Host:	mysql.creware.com
# Root:	/home/alexi/dev/mysql-5.0-0

--- 1.172/sql/item_cmpfunc.cc	2005-09-06 23:23:32 +04:00
+++ 1.173/sql/item_cmpfunc.cc	2005-09-07 17:26:12 +04:00
@@ -1018,9 +1018,9 @@
 */
 
 bool
-Item_func_between::fix_fields(THD *thd, struct st_table_list *tables, Item **ref)
+Item_func_between::fix_fields(THD *thd, Item **ref)
 {
-  if (Item_func_opt_neg::fix_fields(thd, tables, ref))
+  if (Item_func_opt_neg::fix_fields(thd, ref))
     return 1;
 
   /* not_null_tables_cache == union(T1(e),T1(e1),T1(e2)) */
@@ -1132,8 +1132,8 @@
     a_dec= args[1]->val_decimal(&a_buf);
     b_dec= args[2]->val_decimal(&b_buf);
     if (!args[1]->null_value && !args[2]->null_value)
-      return (my_decimal_cmp(dec, a_dec)>=0) && (my_decimal_cmp(dec,
b_dec)<=0);
-
+      return (longlong) ((my_decimal_cmp(dec, a_dec) >= 0 &&
+                          my_decimal_cmp(dec, b_dec) <= 0) != negated);
     if (args[1]->null_value && args[2]->null_value)
       null_value=1;
     else if (args[1]->null_value)
@@ -1320,12 +1320,12 @@
 */
 
 bool
-Item_func_if::fix_fields(THD *thd, struct st_table_list *tlist, Item **ref)
+Item_func_if::fix_fields(THD *thd, Item **ref)
 {
   DBUG_ASSERT(fixed == 0);
   args[0]->top_level_item();
 
-  if (Item_func::fix_fields(thd, tlist, ref))
+  if (Item_func::fix_fields(thd, ref))
     return 1;
 
   not_null_tables_cache= (args[1]->not_null_tables()
@@ -2305,11 +2305,11 @@
 */
 
 bool
-Item_func_in::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
+Item_func_in::fix_fields(THD *thd, Item **ref)
 {
   Item **arg, **arg_end;
 
-  if (Item_func_opt_neg::fix_fields(thd, tables, ref))
+  if (Item_func_opt_neg::fix_fields(thd, ref))
     return 1;
 
   /* not_null_tables_cache == union(T1(e),union(T1(ei))) */

--- 1.186/sql/opt_range.cc	2005-09-06 23:49:45 +04:00
+++ 1.187/sql/opt_range.cc	2005-09-07 17:29:04 +04:00
@@ -3524,20 +3524,12 @@
   }
 
   Item_func *cond_func= (Item_func*) cond;
-  if (cond_func->functype() == Item_func::NOT_FUNC)
-  {
-    /* Optimize NOT BETWEEN and NOT IN */
-    Item *arg= cond_func->arguments()[0];
-    if (arg->type() != Item::FUNC_ITEM)
-      DBUG_RETURN(0);
-    cond_func= (Item_func*) arg;
-    if (cond_func->functype() != Item_func::BETWEEN &&
-        cond_func->functype() != Item_func::IN_FUNC)
-      DBUG_RETURN(0);
-    inv= TRUE;
-  }
+  if (cond_func->functype() == Item_func::BETWEEN ||
+      cond_func->functype() == Item_func::IN_FUNC)
+    inv= ((Item_func_opt_neg *) cond_func)->negated;
   else if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE)
     DBUG_RETURN(0);			       
+
   param->cond= cond;
 
   switch (cond_func->functype()) {

--- 1.365/sql/sql_select.cc	2005-09-02 17:21:08 +04:00
+++ 1.366/sql/sql_select.cc	2005-09-07 17:29:36 +04:00
@@ -2862,19 +2862,6 @@
   if (cond->type() != Item::FUNC_ITEM)
     return;
   Item_func *cond_func= (Item_func*) cond;
-  if (cond_func->functype() == Item_func::NOT_FUNC)
-  {
-    Item *item= cond_func->arguments()[0];
-    /*
-      At this moment all NOT before simple comparison predicates
-      are eliminated. NOT IN and NOT BETWEEN are treated similar
-      IN and BETWEEN respectively.
-    */
-    if (item->type() == Item::FUNC_ITEM &&
-        ((Item_func *) item)->select_optimize() == Item_func::OPTIMIZE_KEY)
-      add_key_fields(key_fields,and_level,item,usable_tables);
-    return;
-  }
   switch (cond_func->select_optimize()) {
   case Item_func::OPTIMIZE_NONE:
     break;

--- 1.417/sql/sql_yacc.yy	2005-09-06 23:49:45 +04:00
+++ 1.418/sql/sql_yacc.yy	2005-09-07 17:34:27 +04:00
@@ -4274,7 +4274,9 @@
             else
             {
               $5->push_front($1);
-              $$= negate_expression(YYTHD, new Item_func_in(*$5));
+              Item_func_in *item = new Item_func_in(*$5);
+              item->negate();
+              $$= item;
             }            
           }
         | bit_expr IN_SYM in_subselect
@@ -4284,7 +4286,11 @@
 	| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
 	  { $$= new Item_func_between($1,$3,$5); }
 	| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
-	  { $$= negate_expression(YYTHD, new Item_func_between($1,$4,$6)); }
+    {
+      Item_func_between *item= new Item_func_between($1,$4,$6);
+      item->negate();
+      $$= item;
+    }
 	| bit_expr SOUNDS_SYM LIKE bit_expr
 	  { $$= new Item_func_eq(new Item_func_soundex($1),
 				 new Item_func_soundex($4)); }
@@ -4349,12 +4355,6 @@
 all_or_any: ALL     { $$ = 1; }
         |   ANY_SYM { $$ = 0; }
         ;
-
-
-
-
-
-
 
 interval_expr:
          INTERVAL_SYM expr { $$=$2; }

--- 1.43/mysql-test/r/join_outer.result	2005-09-06 23:49:45 +04:00
+++ 1.44/mysql-test/r/join_outer.result	2005-09-07 17:35:38 +04:00
@@ -1123,14 +1123,14 @@
 7	8	7	5
 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a OR t1.a = t2.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	
+1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	Using where
 1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.a	1	
 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a IN(t2.a, t2.b);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	
-1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.a	1	Using where
+1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.a	1	
 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a > IF(t1.a = t2.b-2,
t2.b, t2.b-1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	
-1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.a	1	Using where
+1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.a	1	
 DROP TABLE t1,t2;
Thread
bk commit into 5.0 tree (aivanov:1.1968)Alex Ivanov7 Sep
  • Re: bk commit into 5.0 tree (aivanov:1.1968)SGreen7 Sep