List:Commits« Previous MessageNext Message »
From:igor Date:January 7 2006 7:26am
Subject:bk commit into 5.1 tree (igor:1.2049)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of igor. When igor 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.2049 06/01/06 23:26:20 igor@stripped +3 -0
  Merge rurik.mysql.com:/home/igor/dev/mysql-5.0-0
  into  rurik.mysql.com:/home/igor/dev/mysql-5.1-0

  sql/opt_sum.cc
    1.47 06/01/06 23:26:13 igor@stripped +0 -0
    Auto merged

  mysql-test/t/view.test
    1.132 06/01/06 23:26:13 igor@stripped +0 -0
    Auto merged

  mysql-test/r/view.result
    1.144 06/01/06 23:26:13 igor@stripped +0 -0
    Auto merged

# 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:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/dev/mysql-5.1-0/RESYNC

--- 1.46/sql/opt_sum.cc	2005-10-06 01:25:59 -07:00
+++ 1.47/sql/opt_sum.cc	2006-01-06 23:26:13 -08:00
@@ -180,14 +180,14 @@
           indexes to find the key.
         */
         Item *expr=item_sum->args[0];
-        if (expr->type() == Item::FIELD_ITEM)
+        if (expr->real_item()->type() == Item::FIELD_ITEM)
         {
           byte key_buff[MAX_KEY_LENGTH];
           TABLE_REF ref;
           uint range_fl, prefix_len;
 
           ref.key_buff= key_buff;
-          Item_field *item_field= ((Item_field*) expr);
+          Item_field *item_field= (Item_field*) (expr->real_item());
           TABLE *table= item_field->field->table;
 
           /* 
@@ -267,14 +267,14 @@
           indexes to find the key.
         */
         Item *expr=item_sum->args[0];
-        if (expr->type() == Item::FIELD_ITEM)
+        if (expr->real_item()->type() == Item::FIELD_ITEM)
         {
           byte key_buff[MAX_KEY_LENGTH];
           TABLE_REF ref;
-	      uint range_fl, prefix_len;
+          uint range_fl, prefix_len;
 
           ref.key_buff= key_buff;
-	      Item_field *item_field= ((Item_field*) expr);
+          Item_field *item_field= (Item_field*) (expr->real_item());
           TABLE *table= item_field->field->table;
 
           /* 

--- 1.143/mysql-test/r/view.result	2006-01-06 10:34:55 -08:00
+++ 1.144/mysql-test/r/view.result	2006-01-06 23:26:13 -08:00
@@ -2475,3 +2475,32 @@
 5	5
 drop view v2, v1;
 drop table t1;
+CREATE TABLE t1 (a int PRIMARY KEY, b int);
+INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT MAX(a) FROM t1;
+MAX(a)
+5
+SELECT MAX(a) FROM v1;
+MAX(a)
+5
+EXPLAIN SELECT MAX(a) FROM t1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+EXPLAIN SELECT MAX(a) FROM v1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+SELECT MIN(a) FROM t1;
+MIN(a)
+0
+SELECT MIN(a) FROM v1;
+MIN(a)
+0
+EXPLAIN SELECT MIN(a) FROM t1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+EXPLAIN SELECT MIN(a) FROM v1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+DROP VIEW v1;
+DROP TABLE t1;

--- 1.131/mysql-test/t/view.test	2006-01-06 10:34:55 -08:00
+++ 1.132/mysql-test/t/view.test	2006-01-06 23:26:13 -08:00
@@ -2343,3 +2343,27 @@
 
 drop view v2, v1;
 drop table t1;
+
+#
+# Bug#16016: MIN/MAX optimization for views
+#
+
+CREATE TABLE t1 (a int PRIMARY KEY, b int);
+INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT MAX(a) FROM t1;
+SELECT MAX(a) FROM v1;
+
+EXPLAIN SELECT MAX(a) FROM t1;
+EXPLAIN SELECT MAX(a) FROM v1;
+
+SELECT MIN(a) FROM t1;
+SELECT MIN(a) FROM v1;
+
+EXPLAIN SELECT MIN(a) FROM t1;
+EXPLAIN SELECT MIN(a) FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1;
Thread
bk commit into 5.1 tree (igor:1.2049)igor7 Jan