diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-03-16 01:57:59 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2016-03-16 01:57:59 +0200 |
commit | 21651541ce0b2cc0e777988f1e35040b4badfce1 (patch) | |
tree | 12439f836abeb6658987e3aea41d9bd0c3df37f0 /sql/item_sum.h | |
parent | aa74fef25e854741bd58e6cc3afc68ae2091e447 (diff) | |
download | mariadb-git-21651541ce0b2cc0e777988f1e35040b4badfce1.tar.gz |
Implemented avg() window function.
It is based on the sum() function, thus much of the logic is shared.
Considering that there are 2 counters stored within the function, one
that handles the null value, while the other that handles the divisor
for the avg computation, it is possible to remove the counter from the
Item_sum_avg. I have not removed it in this patch as we may choose to
refactor the whole code into a separate class.
This remains to be dicussed.
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r-- | sql/item_sum.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h index 6698a1b2169..b8f41030465 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -837,6 +837,8 @@ class Item_sum_count :public Item_sum_int class Item_sum_avg :public Item_sum_sum { public: + // TODO-cvicentiu given that Item_sum_sum now uses a counter of its own, in + // order to implement remove(), it is possible to remove this member. ulonglong count; uint prec_increment; uint f_precision, f_scale, dec_bin_size; @@ -855,6 +857,7 @@ public: } void clear(); bool add(); + void remove(); double val_real(); // In SPs we might force the "wrong" type with select into a declare variable longlong val_int() { return val_int_from_real(); } |