diff options
| author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-06 09:40:39 +0200 |
|---|---|---|
| committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-06 09:40:39 +0200 |
| commit | df563e0c037f9b2cdb22e145575f92a121b4b529 (patch) | |
| tree | 31d39796cebcef916eb7e0888537c18f946170ff /sql/sql_window.cc | |
| parent | e058a251c10350f3727ca1df022dc5786933535b (diff) | |
| parent | bdfe2784d5b73a1fdcdacb3d9adcc9dc71af344b (diff) | |
| download | mariadb-git-df563e0c037f9b2cdb22e145575f92a121b4b529.tar.gz | |
Merge 10.2 into 10.3
main.derived_cond_pushdown: Move all 10.3 tests to the end,
trim trailing white space, and add an "End of 10.3 tests" marker.
Add --sorted_result to tests where the ordering is not deterministic.
main.win_percentile: Add --sorted_result to tests where the
ordering is no longer deterministic.
Diffstat (limited to 'sql/sql_window.cc')
| -rw-r--r-- | sql/sql_window.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc index e4d69f2fa5e..dcc6a7bac1c 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2941,7 +2941,7 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result) } -bool Window_funcs_sort::exec(JOIN *join) +bool Window_funcs_sort::exec(JOIN *join, bool keep_filesort_result) { THD *thd= join->thd; JOIN_TAB *join_tab= join->join_tab + join->total_join_tab_cnt(); @@ -2956,8 +2956,11 @@ bool Window_funcs_sort::exec(JOIN *join) bool is_error= runner.exec(thd, tbl, filesort_result); - delete join_tab->filesort_result; - join_tab->filesort_result= NULL; + if (!keep_filesort_result) + { + delete join_tab->filesort_result; + join_tab->filesort_result= NULL; + } return is_error; } @@ -3066,14 +3069,18 @@ bool Window_funcs_computation::setup(THD *thd, } -bool Window_funcs_computation::exec(JOIN *join) +bool Window_funcs_computation::exec(JOIN *join, bool keep_last_filesort_result) { List_iterator<Window_funcs_sort> it(win_func_sorts); Window_funcs_sort *srt; + uint counter= 0; /* Count how many sorts we've executed. */ /* Execute each sort */ while ((srt = it++)) { - if (srt->exec(join)) + counter++; + bool keep_filesort_result= keep_last_filesort_result && + counter == win_func_sorts.elements; + if (srt->exec(join, keep_filesort_result)) return true; } return false; |
