diff options
author | Varun Gupta <varunraiko1803@gmail.com> | 2018-05-08 15:00:17 +0530 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2018-05-11 03:23:17 +0530 |
commit | 16319409bf53ffb9860d82778ae0997a7a19d381 (patch) | |
tree | 36006aa00fdbfd53bc4339eb1668356ed1a01afb /sql/sql_select.h | |
parent | e5bd75fb4e246b9f0494aab05dd557b18d5921cd (diff) | |
download | mariadb-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_select.h')
-rw-r--r-- | sql/sql_select.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index 2003cc1211b..a134d601c76 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1503,6 +1503,15 @@ public: /* Number of tables actually joined at the top level */ uint exec_join_tab_cnt() { return tables_list ? top_join_tab_count : 0; } + /* + Number of tables in the join which also includes the temporary tables + created for GROUP BY, DISTINCT , WINDOW FUNCTION etc. + */ + uint total_join_tab_cnt() + { + return exec_join_tab_cnt() + aggr_tables - 1; + } + int prepare(TABLE_LIST *tables, uint wind_num, COND *conds, uint og_num, ORDER *order, bool skip_order_by, ORDER *group, Item *having, ORDER *proc_param, SELECT_LEX *select, |