List:Internals« Previous MessageNext Message »
From:eugene Date:September 14 2005 6:22pm
Subject:bk commit into 4.1 tree (evgen:1.2434) BUG#12887
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of evgen. When evgen 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.2434 05/09/14 20:22:28 evgen@stripped +3 -0
  Fix bug#12887 Distinct is not always applied after rollup
  
  For queries with GROUP BY and without hidden GROUP BY fields DISTINCT is
  optimized away becuase such queries produce result set without duplicates.
  But ROLLUP can add rows which may be same to some rows and this fact was
  ignored.
  
  Added check so if ROLLUP is present DISTINCT can't be optimized away.

  mysql-test/t/olap.test
    1.19 05/09/14 20:15:24 evgen@stripped +8 -0
    Test case for bug #12887 Distinct is not always applied after rollup

  mysql-test/r/olap.result
    1.22 05/09/14 20:15:05 evgen@stripped +7 -0
    Test case for bug #12887 Distinct is not always applied after rollup

  sql/sql_select.cc
    1.436 05/09/14 20:13:55 evgen@stripped +1 -1
    Fix bug #12887 Distinct is not always applied after rollup

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/12887-bug-4.1-mysql

--- 1.435/sql/sql_select.cc	2005-09-12 19:48:12 +04:00
+++ 1.436/sql/sql_select.cc	2005-09-14 20:13:55 +04:00
@@ -618,7 +618,7 @@
   }
   if (group_list || tmp_table_param.sum_func_count)
   {
-    if (! hidden_group_fields)
+    if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
       select_distinct=0;
   }
   else if (select_distinct && tables - const_tables == 1)

--- 1.21/mysql-test/r/olap.result	2005-09-08 23:31:31 +04:00
+++ 1.22/mysql-test/r/olap.result	2005-09-14 20:15:05 +04:00
@@ -529,3 +529,10 @@
 2	1	1
 NULL	NULL	2
 DROP TABLE t1;
+create table t1 ( a varchar(9), b int );
+insert into t1 values('a',1),(null,2);
+select distinct a, max(b) from t1 group by a with rollup;
+a	max(b)
+NULL	2
+a	1
+drop table t1;

--- 1.18/mysql-test/t/olap.test	2005-09-08 23:32:12 +04:00
+++ 1.19/mysql-test/t/olap.test	2005-09-14 20:15:24 +04:00
@@ -263,4 +263,12 @@
 
 DROP TABLE t1;
 
+#
+# Bug #12887 Distinct is not always applied after rollup
+#
+create table t1 ( a varchar(9), b int );
+insert into t1 values('a',1),(null,2);
+select distinct a, max(b) from t1 group by a with rollup;
+drop table t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (evgen:1.2434) BUG#12887eugene14 Sep