diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-06-13 16:54:40 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-07-05 17:18:01 +0300 |
commit | effbd52b8c88491740915123c1ea3363d3795d66 (patch) | |
tree | b461b75771df258ccba727ee49d07b2adfae9064 /sql/sql_window.h | |
parent | 4f93c732d5c286b655a1d6b434e7190800d89c8f (diff) | |
download | mariadb-git-bb-10.2-vicentiu3.tar.gz |
MDEV-10879: Window Functions final ordering of result setbb-10.2-vicentiu3
Window functions now force an ordering to the result set if none is
specified through order by. The ordering that will be returned is the final ordering
that is used during window function computation. For multiple window functions,
it should generally be the most specific sort ordering for the final
window function in the select list.
Diffstat (limited to 'sql/sql_window.h')
-rw-r--r-- | sql/sql_window.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/sql_window.h b/sql/sql_window.h index 6a56fc84392..e9e86e7c9ef 100644 --- a/sql/sql_window.h +++ b/sql/sql_window.h @@ -195,14 +195,20 @@ class Window_funcs_sort : public Sql_alloc public: bool setup(THD *thd, SQL_SELECT *sel, List_iterator<Item_window_func> &it, st_join_table *join_tab); - bool exec(JOIN *join); + /* + Execute the window functions requiring the previously set up sort order. + + @param keep_filesort_result: Do not delete the filesort_result after + sorting the table if it is set to true. + Otherwise free it. + */ + bool exec(JOIN *join, bool keep_filesort_result); void cleanup() { delete filesort; } +private: friend class Window_funcs_computation; -private: Window_func_runner runner; - /* Window functions can be computed over this sorting */ Filesort *filesort; }; @@ -225,7 +231,7 @@ class Window_funcs_computation : public Sql_alloc List<Window_funcs_sort> win_func_sorts; public: bool setup(THD *thd, List<Item_window_func> *window_funcs, st_join_table *tab); - bool exec(JOIN *join); + bool exec(JOIN *join, bool keep_final_sort_result); Explain_aggr_window_funcs *save_explain_plan(MEM_ROOT *mem_root, bool is_analyze); void cleanup(); |