List:Internals« Previous MessageNext Message »
From:sanja Date:June 14 2005 11:24pm
Subject:bk commit into 5.0 tree (bell:1.1937) BUG#7015
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell 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.1937 05/06/15 00:24:41 bell@stripped +4 -0
  fixed printing of sum(distinct ) & avg(distinct ) (BUG#7015)

  sql/item_sum.h
    1.88 05/06/15 00:23:47 bell@stripped +4 -3
    function names for print()

  sql/item_sum.cc
    1.151 05/06/15 00:23:47 bell@stripped +9 -0
    correct print item

  mysql-test/t/view.test
    1.71 05/06/15 00:23:47 bell@stripped +11 -0
    using sum(distinct ) & avg(distinct ) in views

  mysql-test/r/view.result
    1.82 05/06/15 00:23:47 bell@stripped +12 -0
    using sum(distinct ) & avg(distinct ) in views

# 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:	bell
# Host:	sanja.is.com.ua
# Root:	/home/bell/mysql/bk/work-bug4-5.0

--- 1.150/sql/item_sum.cc	Tue Jun  7 05:43:54 2005
+++ 1.151/sql/item_sum.cc	Wed Jun 15 00:23:47 2005
@@ -724,6 +724,15 @@
   return val.traits->val_str(&val, str, decimals);
 }
 
+void Item_sum_distinct::print(String *str)
+{
+  str->append(func_name());
+  str->append("(distinct ", 10);
+  args[0]->print(str);
+  str->append(')');
+}
+
+
 /* end of Item_sum_distinct */
 
 /* Item_sum_avg_distinct */

--- 1.87/sql/item_sum.h	Tue May 10 13:33:41 2005
+++ 1.88/sql/item_sum.h	Wed Jun 15 00:23:47 2005
@@ -206,6 +206,7 @@
   enum Item_result result_type () const { return val.traits->type(); }
   virtual void calculate_val_and_count();
   virtual bool unique_walk_function(void *elem);
+  void print(String *str);
 };
 
 
@@ -224,7 +225,7 @@
   Item_sum_sum_distinct(Item *item_arg) :Item_sum_distinct(item_arg) {}
 
   enum Sumfunctype sum_func () const { return SUM_DISTINCT_FUNC; }
-  const char *func_name() const { return "sum_distinct"; }
+  const char *func_name() const { return "sum"; }
   Item *copy_or_same(THD* thd) { return new Item_sum_sum_distinct(thd, this); }
 };
 
@@ -243,7 +244,7 @@
   void fix_length_and_dec();
   virtual void calculate_val_and_count();
   enum Sumfunctype sum_func () const { return AVG_DISTINCT_FUNC; }
-  const char *func_name() const { return "avg_distinct"; }
+  const char *func_name() const { return "avg"; }
   Item *copy_or_same(THD* thd) { return new Item_sum_avg_distinct(thd, this); }
 };
 
@@ -326,7 +327,7 @@
   longlong val_int();
   void reset_field() { return ;}		// Never called
   void update_field() { return ; }		// Never called
-  const char *func_name() const { return "count_distinct"; }
+  const char *func_name() const { return "count"; }
   bool setup(THD *thd);
   void make_unique();
   Item *copy_or_same(THD* thd);

--- 1.81/mysql-test/r/view.result	Tue May 17 18:05:06 2005
+++ 1.82/mysql-test/r/view.result	Wed Jun 15 00:23:47 2005
@@ -1726,3 +1726,15 @@
 drop procedure p1;
 drop view v1;
 drop table t1;
+create table t1 (s1 int);
+create view  v1 as select sum(distinct s1) from t1;
+select * from v1;
+sum(distinct s1)
+NULL
+drop view v1;
+create view  v1 as select avg(distinct s1) from t1;
+select * from v1;
+avg(distinct s1)
+NULL
+drop view v1;
+drop table t1;

--- 1.70/mysql-test/t/view.test	Tue May 17 18:05:06 2005
+++ 1.71/mysql-test/t/view.test	Wed Jun 15 00:23:47 2005
@@ -1569,3 +1569,14 @@
 drop view v1;
 drop table t1;
 
+#
+# using sum(distinct ) & avg(distinct ) in views (BUG#7015)
+#
+create table t1 (s1 int);
+create view  v1 as select sum(distinct s1) from t1;
+select * from v1;
+drop view v1;
+create view  v1 as select avg(distinct s1) from t1;
+select * from v1;
+drop view v1;
+drop table t1;
Thread
bk commit into 5.0 tree (bell:1.1937) BUG#7015sanja14 Jun