diff options
author | unknown <konstantin@mysql.com> | 2005-03-13 23:50:43 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-03-13 23:50:43 +0300 |
commit | 1534ed8e1553eb3105bc06d963038a82d548b8d9 (patch) | |
tree | dfbb52f3c23bf61610783925dd1ed12c6c69942f /sql/sql_select.h | |
parent | 08e23eb602937a5957899e9230f93ca96b25a9ce (diff) | |
download | mariadb-git-1534ed8e1553eb3105bc06d963038a82d548b8d9.tar.gz |
WL#926 "SUM(DISTINCT) and AVG(DISTINCT)": improvement of SUM(DISTINCT) and
implementation of AVG(DISTINCT) which utilizes the approach with Fields.
The patch implemented in October is portede to the up-to-date tree
containing DECIMAL type.
Tests for AVG(DISTINCT) (although there is not much to test provided
that SUM(DISTINCT) works), cleanups for COUNT(DISTINCT) and GROUP_CONCAT()
will follow in another changeset.
sql/field.cc:
A handy way to init create_field used for use with virtual tmp tables.
Feel free to extend it for your own needs.
sql/field.h:
Declaration for create_field::init_for_tmp_table()
sql/item.cc:
Implementation for a framework used to easily handle different result
types of SQL expressions. Instead of having instances of each possible
result type (integer, decimal, double) in every item, variables
of all used types are moved to struct Hybrid_type.
Hybrid_type can change its dynamic type in runtime, and become,
for instance, DECIMAL from INTEGER.
All type-specific Item operations are moved to the class hierarchy
Hybrid_type_traits. Item::decimals and Item::max_length can
be moved to Hybrid_type as well.
sql/item.h:
Declaration for Hybrid_type framework. See also comments for item.cc
in this changeset.
sql/item_sum.cc:
Rewritten implementation for Item_sum_sum_distinct (SUM(DISTINCT))
and added implementation for Item_sum_avg_distinct (AVG(DISTINCT)).
The classes utilize Hybrid_type class hierarchy and Fields to
convert SUM/AVG arguments to binary representation and store in a RB-tree.
sql/item_sum.h:
Declarations for Item_sum_distinct (the new intermediate class used
for SUM and AVG distinct), Item_sum_sum_distinct, Item_sum_avg_distinct.
sql/sql_select.cc:
Implementatio of create_virtual_tmp_table().
sql/sql_select.h:
Declaration for create_virtual_tmp_table.
sql/sql_yacc.yy:
Grammar support for Item_sum_avg_distinct.
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index 1b7893dbc7c..f00fd476edd 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -387,6 +387,7 @@ TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ORDER *group, bool distinct, bool save_sum_fields, ulong select_options, ha_rows rows_limit, char* alias); +TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list); void free_tmp_table(THD *thd, TABLE *entry); void count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields, bool reset_with_sum_func); |