summaryrefslogtreecommitdiff
path: root/sql/sql_window.cc
diff options
context:
space:
mode:
authorVarun Gupta <varunraiko1803@gmail.com>2018-05-08 15:00:17 +0530
committerVarun Gupta <varunraiko1803@gmail.com>2018-05-11 03:23:17 +0530
commit16319409bf53ffb9860d82778ae0997a7a19d381 (patch)
tree36006aa00fdbfd53bc4339eb1668356ed1a01afb /sql/sql_window.cc
parente5bd75fb4e246b9f0494aab05dd557b18d5921cd (diff)
downloadmariadb-git-16319409bf53ffb9860d82778ae0997a7a19d381.tar.gz
MDEV-15853: Assertion `tab->filesort_result == 0' failed
The issue here is that the window function execution is not called for the correct join tab, when we have GROUP BY where we create extra temporary tables then we need to call window function execution for the last join tab. For doing so the current code does not take into account the JOIN::aggr_tables. Fixed by introducing a new function JOIN::total_join_tab_cnt that takes in account the temporary tables also.
Diffstat (limited to 'sql/sql_window.cc')
-rw-r--r--sql/sql_window.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 4e1e64365ae..cd09e174808 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -2754,7 +2754,7 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result)
bool Window_funcs_sort::exec(JOIN *join)
{
THD *thd= join->thd;
- JOIN_TAB *join_tab= join->join_tab + join->exec_join_tab_cnt();
+ JOIN_TAB *join_tab= join->join_tab + join->total_join_tab_cnt();
/* Sort the table based on the most specific sorting criteria of
the window functions. */