1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed the bug mdev-11990.

The usage of windows functions when all tables were optimized away
by min/max optimization were not supported. As result a result,
the queries that used window functions with min/max aggregation
over the whole table returned wrong result sets.
The patch fixed this problem.
This commit is contained in:
Igor Babaev
2017-05-03 13:49:43 -07:00
parent 52463ccff7
commit ce8ee7d90b
6 changed files with 90 additions and 31 deletions

View File

@ -2761,7 +2761,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->top_join_tab_count];
JOIN_TAB *join_tab= join->join_tab + join->exec_join_tab_cnt();
/* Sort the table based on the most specific sorting criteria of
the window functions. */
@ -2841,11 +2841,6 @@ bool Window_funcs_sort::setup(THD *thd, SQL_SELECT *sel,
sort_order= order;
}
filesort= new (thd->mem_root) Filesort(sort_order, HA_POS_ERROR, true, NULL);
if (!join_tab->join->top_join_tab_count)
{
filesort->tracker=
new (thd->mem_root) Filesort_tracker(thd->lex->analyze_stmt);
}
/* Apply the same condition that the subsequent sort has. */
filesort->select= sel;