List:Internals« Previous MessageNext Message »
From:igor Date:July 1 2005 12:46pm
Subject:bk commit into 5.0 tree (igor:1.1860) BUG#11639
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.1860 05/07/01 03:46:08 igor@stripped +5 -0
  view.result:
    Fixed the results of a test for group_concat.
    After the fix foor bug #11639 the results became
    correct.
  olap.result, olap.test:
    Added a test case for bug #11639.
  sql_select.cc:
    Fixed bug #11639: a wrong result set when using a view
    instead of the underlying table in a rollup query 
    executed through filesort.
    The old code did not take into account that we always
    use an Item_ref object when referring to a view column.
  item.h:
    Fixed bug #11639.
    Now if two Item_ref items ref1 and ref2 refer to the same field
    then ref1->eq(ref2) returns 1.

  mysql-test/r/view.result
    1.88 05/07/01 03:44:03 igor@stripped +1 -1
    Fixed the results of a test for group_concat.
    After the fix foor bug #11639 the results became
    correct.

  mysql-test/r/olap.result
    1.25 05/07/01 03:40:58 igor@stripped +22 -0
    Added a test case for bug #11639.

  mysql-test/t/olap.test
    1.18 05/07/01 03:40:21 igor@stripped +16 -0
    Added a test case for bug #11639.

  sql/sql_select.cc
    1.325 05/07/01 03:33:43 igor@stripped +4 -3
    Fixed bug #11639: a wrong result set when using a view
    instead of the underlying table in a rollup query 
    executed through filesort.
    The old code did not take into account that we always
    use an Item_ref object when referring to a view column.

  sql/item.h
    1.145 05/07/01 03:26:07 igor@stripped +4 -1
    Fixed bug #11639.
    Now if two Item_ref items ref1 and ref2 refer to the same field
    then ref1->eq(ref2) returns 1.

# 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.0-0

--- 1.144/sql/item.h	Wed Jun 22 13:56:00 2005
+++ 1.145/sql/item.h	Fri Jul  1 03:26:07 2005
@@ -1340,7 +1340,10 @@
   Item_ref(THD *thd, Item_ref *item) :Item_ident(thd, item),
result_field(item->result_field), ref(item->ref) {}
   enum Type type() const		{ return REF_ITEM; }
   bool eq(const Item *item, bool binary_cmp) const
-  { return ref && (*ref)->eq(item, binary_cmp); }
+  { 
+    Item *it= ((Item *) item)->real_item();
+    return ref && (*ref)->eq(it, binary_cmp);
+  }
   double val_real();
   longlong val_int();
   my_decimal *val_decimal(my_decimal *);

--- 1.324/sql/sql_select.cc	Thu Jun 30 03:20:46 2005
+++ 1.325/sql/sql_select.cc	Fri Jul  1 03:33:43 2005
@@ -12150,7 +12150,7 @@
   param->quick_group=1;
   while ((field=li++))
   {
-    Item::Type type=field->type();
+    Item::Type type=field->real_item()->type();
     if (type == Item::FIELD_ITEM)
       param->field_count++;
     else if (type == Item::SUM_FUNC_ITEM)
@@ -12164,7 +12164,7 @@
 
 	for (uint i=0 ; i < sum_item->arg_count ; i++)
 	{
-	  if (sum_item->args[0]->type() == Item::FIELD_ITEM)
+	  if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM)
 	    param->field_count++;
 	  else
 	    param->func_count++;
@@ -12411,9 +12411,10 @@
   param->copy_funcs.empty();
   for (i= 0; (pos= li++); i++)
   {
-    if (pos->type() == Item::FIELD_ITEM)
+    if (pos->real_item()->type() == Item::FIELD_ITEM)
     {
       Item_field *item;
+      pos= pos->real_item();
       if (!(item= new Item_field(thd, ((Item_field*) pos))))
 	goto err;
       pos= item;

--- 1.24/mysql-test/r/olap.result	Mon Jun  6 11:21:22 2005
+++ 1.25/mysql-test/r/olap.result	Fri Jul  1 03:40:58 2005
@@ -555,3 +555,25 @@
 4	TEST
 TEST	TEST
 DROP TABLE t1,t2;
+CREATE TABLE t1(id int, type char(1));
+INSERT INTO t1 VALUES
+(1,"A"),(2,"C"),(3,"A"),(4,"A"),(5,"B"),
+(6,"B"),(7,"A"),(8,"C"),(9,"A"),(10,"C");
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT type FROM t1 GROUP BY type WITH ROLLUP;
+type
+A
+B
+C
+NULL
+SELECT type FROM v1 GROUP BY type WITH ROLLUP;
+type
+A
+B
+C
+NULL
+EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	10	Using filesort
+DROP VIEW v1;
+DROP TABLE t1;

--- 1.17/mysql-test/t/olap.test	Mon May 30 05:33:13 2005
+++ 1.18/mysql-test/t/olap.test	Fri Jul  1 03:40:21 2005
@@ -250,3 +250,19 @@
 
 DROP TABLE t1,t2;
 
+#
+# Tests for bug #11639: ROLLUP over view executed through filesort
+#
+
+CREATE TABLE t1(id int, type char(1));
+INSERT INTO t1 VALUES
+  (1,"A"),(2,"C"),(3,"A"),(4,"A"),(5,"B"),
+  (6,"B"),(7,"A"),(8,"C"),(9,"A"),(10,"C");
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT type FROM t1 GROUP BY type WITH ROLLUP;
+SELECT type FROM v1 GROUP BY type WITH ROLLUP;
+EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP;
+
+DROP VIEW v1;
+DROP TABLE t1;

--- 1.87/mysql-test/r/view.result	Fri Jun 24 10:47:16 2005
+++ 1.88/mysql-test/r/view.result	Fri Jul  1 03:44:03 2005
@@ -1561,7 +1561,7 @@
 two	1050,1050
 select col1,group_concat(col2,col3) from v1 group by col1;
 col1	group_concat(col2,col3)
-two	1025,2025,3025
+one	1025,2025,3025
 two	1050,1050
 drop view v1;
 drop table t1;
Thread
bk commit into 5.0 tree (igor:1.1860) BUG#11639igor1 Jul