mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-9634: Window function produces incorrect value
- Item_sum_count::remove() should check if the argument's value is NULL. - Window Function item must have its Item_window_func::split_sum_func called, - and it must call split_sum_func for aggregate's arguments (see the comment near Item_window_func::split_sum_func for explanation why)
This commit is contained in:
@ -7966,8 +7966,12 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
|
||||
ref[0]= item;
|
||||
ref.pop_front();
|
||||
}
|
||||
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
|
||||
sum_func_list)
|
||||
/*
|
||||
split_sum_func() must be called for Window Function items, see
|
||||
Item_window_func::split_sum_func.
|
||||
*/
|
||||
if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
|
||||
sum_func_list) || item->type() == Item::WINDOW_FUNC_ITEM)
|
||||
item->split_sum_func(thd, ref_pointer_array, *sum_func_list,
|
||||
SPLIT_SUM_SELECT);
|
||||
thd->lex->current_select->select_list_tables|= item->used_tables();
|
||||
|
Reference in New Issue
Block a user