diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2016-03-28 20:53:09 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2016-03-28 20:53:09 +0300 |
commit | d146c2cedc88e6d8728584b83861bd9b677a44a3 (patch) | |
tree | aa480e73f18421010e3fbee7d9e0172a9b7ceae2 /sql/sql_window.cc | |
parent | e88758330c49b40556a1f9c3d316b66ce11ca67d (diff) | |
download | mariadb-git-d146c2cedc88e6d8728584b83861bd9b677a44a3.tar.gz |
MDEV-9787: Window functions: HAVING and GROUP BY
- Hook window function computation into the right location.
- Add a testcase which shows that HAVING is now checked before
the window function computation step.
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r-- | sql/sql_window.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 0352a0dfb5f..f28301c26a4 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -1565,11 +1565,20 @@ bool Window_func_runner::exec(JOIN *join) bool Window_funcs_computation::setup(THD *thd, - List<Item_window_func> *window_funcs) + List<Item_window_func> *window_funcs, + JOIN_TAB *tab) { List_iterator_fast<Item_window_func> it(*window_funcs); Item_window_func *item_win; Window_func_runner *runner; + + SQL_SELECT *sel= NULL; + if (tab->filesort && tab->filesort->select) + { + sel= tab->filesort->select; + DBUG_ASSERT(!sel->quick); + } + // for each window function while ((item_win= it++)) { @@ -1579,6 +1588,8 @@ bool Window_funcs_computation::setup(THD *thd, { return true; } + /* Apply the same condition that the subsequent sort will */ + runner->filesort->select= sel; win_func_runners.push_back(runner, thd->mem_root); } return false; |