diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 139c2c67dad..6eb4ecbb4cf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -933,8 +933,9 @@ JOIN::prepare(TABLE_LIST *tables_init, item->max_length))) real_order= TRUE; - if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) - item->split_sum_func(thd, ref_ptrs, all_fields, 0); + if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) || + item->with_window_func) + item->split_sum_func(thd, ref_ptrs, all_fields, SPLIT_SUM_SELECT); } if (!real_order) order= NULL; @@ -26714,27 +26715,6 @@ AGGR_OP::end_send() } else { - /* - In case we have window functions present, an extra step is required - to compute all the fields from the temporary table. - In case we have a compound expression such as: expr + expr, - where one of the terms has a window function inside it, only - after computing window function values we actually know the true - final result of the compounded expression. - - Go through all the func items and save their values once again in the - corresponding temp table fields. Do this for each row in the table. - */ - if (join_tab->window_funcs_step) - { - Item **func_ptr= join_tab->tmp_table_param->items_to_copy; - Item *func; - for (; (func = *func_ptr) ; func_ptr++) - { - if (func->with_window_func) - func->save_in_result_field(true); - } - } rc= evaluate_join_record(join, join_tab, 0); } } |