mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 03:17:20 +02:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-ps3-4.1 mysql-test/r/union.result: Auto merged sql/item.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/log_event.cc: Auto merged sql/slave.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_parse.cc: Auto merged
This commit is contained in:
commit
0948f9769b
66 changed files with 8271 additions and 670 deletions
|
|
@ -197,18 +197,24 @@ class Item_sum_count_distinct :public Item_sum_int
|
|||
uint key_length;
|
||||
CHARSET_INFO *key_charset;
|
||||
|
||||
// calculated based on max_heap_table_size. If reached,
|
||||
// walk the tree and dump it into MyISAM table
|
||||
/*
|
||||
Calculated based on max_heap_table_size. If reached,
|
||||
walk the tree and dump it into MyISAM table
|
||||
*/
|
||||
uint max_elements_in_tree;
|
||||
|
||||
// the first few bytes of record ( at least one)
|
||||
// are just markers for deleted and NULLs. We want to skip them since
|
||||
// they will just bloat the tree without providing any valuable info
|
||||
/*
|
||||
The first few bytes of record ( at least one)
|
||||
are just markers for deleted and NULLs. We want to skip them since
|
||||
they will just bloat the tree without providing any valuable info
|
||||
*/
|
||||
int rec_offset;
|
||||
|
||||
// If there are no blobs, we can use a tree, which
|
||||
// is faster than heap table. In that case, we still use the table
|
||||
// to help get things set up, but we insert nothing in it
|
||||
/*
|
||||
If there are no blobs, we can use a tree, which
|
||||
is faster than heap table. In that case, we still use the table
|
||||
to help get things set up, but we insert nothing in it
|
||||
*/
|
||||
bool use_tree;
|
||||
bool always_null; // Set to 1 if the result is always NULL
|
||||
|
||||
|
|
@ -312,18 +318,17 @@ public:
|
|||
void fix_length_and_dec() {}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
variance(a) =
|
||||
|
||||
variance(a) =
|
||||
|
||||
= sum (ai - avg(a))^2 / count(a) )
|
||||
= sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a)
|
||||
= (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) =
|
||||
= (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) =
|
||||
= (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) =
|
||||
= (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) =
|
||||
= (sum(ai^2) - sum(a)^2/count(a))/count(a)
|
||||
|
||||
= sum (ai - avg(a))^2 / count(a) )
|
||||
= sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a)
|
||||
= (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) =
|
||||
= (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) =
|
||||
= (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) =
|
||||
= (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) =
|
||||
= (sum(ai^2) - sum(a)^2/count(a))/count(a)
|
||||
*/
|
||||
|
||||
class Item_sum_variance : public Item_sum_num
|
||||
|
|
@ -509,8 +514,9 @@ class Item_sum_xor :public Item_sum_bit
|
|||
|
||||
|
||||
/*
|
||||
** user defined aggregates
|
||||
User defined aggregates
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
|
||||
class Item_udf_sum : public Item_sum
|
||||
|
|
@ -668,7 +674,6 @@ class Item_func_group_concat : public Item_sum
|
|||
MYSQL_ERROR *warning;
|
||||
bool warning_available;
|
||||
uint key_length;
|
||||
int rec_offset;
|
||||
bool tree_mode;
|
||||
bool distinct;
|
||||
bool warning_for_row;
|
||||
|
|
@ -676,12 +681,13 @@ class Item_func_group_concat : public Item_sum
|
|||
|
||||
friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
|
||||
byte* key2);
|
||||
friend int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2);
|
||||
friend int group_concat_key_cmp_with_order(void* arg, byte* key1,
|
||||
byte* key2);
|
||||
friend int group_concat_key_cmp_with_distinct_and_order(void* arg,
|
||||
byte* key1,
|
||||
byte* key2);
|
||||
friend int dump_leaf_key(byte* key, uint32 count __attribute__((unused)),
|
||||
Item_func_group_concat *group_concat_item);
|
||||
Item_func_group_concat *group_concat_item);
|
||||
|
||||
public:
|
||||
String result;
|
||||
|
|
@ -695,7 +701,7 @@ class Item_func_group_concat : public Item_sum
|
|||
uint show_elements;
|
||||
uint arg_count_order;
|
||||
uint arg_count_field;
|
||||
uint arg_show_fields;
|
||||
uint field_list_offset;
|
||||
uint count_cut_values;
|
||||
/*
|
||||
Following is 0 normal object and pointer to original one for copy
|
||||
|
|
@ -706,38 +712,12 @@ class Item_func_group_concat : public Item_sum
|
|||
Item_func_group_concat(bool is_distinct,List<Item> *is_select,
|
||||
SQL_LIST *is_order,String *is_separator);
|
||||
|
||||
Item_func_group_concat(THD *thd, Item_func_group_concat *item)
|
||||
:Item_sum(thd, item),item_thd(thd),
|
||||
tmp_table_param(item->tmp_table_param),
|
||||
max_elements_in_tree(item->max_elements_in_tree),
|
||||
warning(item->warning),
|
||||
warning_available(item->warning_available),
|
||||
key_length(item->key_length),
|
||||
rec_offset(item->rec_offset),
|
||||
tree_mode(item->tree_mode),
|
||||
distinct(item->distinct),
|
||||
warning_for_row(item->warning_for_row),
|
||||
separator(item->separator),
|
||||
tree(item->tree),
|
||||
table(item->table),
|
||||
order(item->order),
|
||||
tables_list(item->tables_list),
|
||||
group_concat_max_len(item->group_concat_max_len),
|
||||
show_elements(item->show_elements),
|
||||
arg_count_order(item->arg_count_order),
|
||||
arg_count_field(item->arg_count_field),
|
||||
arg_show_fields(item->arg_show_fields),
|
||||
count_cut_values(item->count_cut_values),
|
||||
original(item)
|
||||
{
|
||||
quick_group= item->quick_group;
|
||||
};
|
||||
Item_func_group_concat(THD *thd, Item_func_group_concat *item);
|
||||
~Item_func_group_concat();
|
||||
void cleanup();
|
||||
|
||||
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
|
||||
const char *func_name() const { return "group_concat"; }
|
||||
enum Type type() const { return SUM_FUNC_ITEM; }
|
||||
virtual Item_result result_type () const { return STRING_RESULT; }
|
||||
void clear();
|
||||
bool add();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue