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

MDEV-12779 Oracle/DB2 Compatibility Implicit Ordering for ROW_NUMBER OVER

Users expect window functions to produce a certain ordering of rows in
the final result set. Although the standard does not require this, we
already have the filesort result done for when we computed the window
function. If there is no ORDER BY attached to the query, just keep it
till the SELECT is completely evaluated and use that to print the
result.

Update test cases as many did not take care to guarantee a stable
result.
This commit is contained in:
Vicențiu Ciorbaru
2018-11-01 08:55:16 +02:00
parent dd6e74c62a
commit 1c6b982e02
12 changed files with 339 additions and 306 deletions

View File

@ -195,7 +195,7 @@ class Window_funcs_sort : public Sql_alloc
public:
bool setup(THD *thd, SQL_SELECT *sel, List_iterator<Item_window_func> &it,
st_join_table *join_tab);
bool exec(JOIN *join);
bool exec(JOIN *join, bool keep_filesort_result);
void cleanup() { delete filesort; }
friend class Window_funcs_computation;
@ -225,7 +225,7 @@ class Window_funcs_computation : public Sql_alloc
List<Window_funcs_sort> win_func_sorts;
public:
bool setup(THD *thd, List<Item_window_func> *window_funcs, st_join_table *tab);
bool exec(JOIN *join);
bool exec(JOIN *join, bool keep_last_filesort_result);
Explain_aggr_window_funcs *save_explain_plan(MEM_ROOT *mem_root, bool is_analyze);
void cleanup();