diff options
author | Varun Gupta <varunraiko1803@gmail.com> | 2017-06-26 02:15:19 +0530 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2017-11-01 23:13:01 +0530 |
commit | 18747a4baa9cc68766eaa7a40e92f8c3d873631a (patch) | |
tree | 172c5d732cbf99b62afe71f4fd379713f07f9576 /sql/item_windowfunc.h | |
parent | 129626f171377c247b71bdda602a554829e4f848 (diff) | |
download | mariadb-git-18747a4baa9cc68766eaa7a40e92f8c3d873631a.tar.gz |
Added value field to Item_sum_percentile_disc
Check for single element in the order_list is added
Diffstat (limited to 'sql/item_windowfunc.h')
-rw-r--r-- | sql/item_windowfunc.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index ac695729fc5..3a774a2ff57 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -705,7 +705,7 @@ class Item_sum_percentile_disc : public Item_sum_cume_dist { public: Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg) - {} + value(NULL) {} double val_real() { @@ -753,7 +753,23 @@ public: Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy<Item_sum_percentile_disc>(thd, mem_root, this); } + void setup_window_func(THD *thd, Window_spec *window_spec); + void setup_percentile_func(THD *thd, SQL_I_List<ORDER> *list) + { + value= new_Cached_item(thd, list->first->item[0], FALSE); + } + void cleanup() + { + if (value) + { + delete value; + value= NULL; + } + Item_sum_num::cleanup(); + } +private: + Cached_item *value; }; @@ -871,6 +887,17 @@ public: } } + bool only_single_element_order_list() const + { + switch(window_func()->sum_func()){ + case Item_sum::PERCENTILE_CONT_FUNC: + case Item_sum::PERCENTILE_DISC_FUNC: + return true; + default: + return false; + } + } + /* Computation functions. TODO: consoder merging these with class Group_bound_tracker. |