[MDEV-10873] Analyze setting final result of compound window functions Created: 2016-09-22  Updated: 2017-10-17

Status: Open
Project: MariaDB Server
Component/s: Optimizer - Window functions
Affects Version/s: 10.2
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: Vicențiu Ciorbaru Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-11907 Bogus 'Division by 0' warnings upon u... Closed

 Description   

This code is now present, right before sending window function results out:

 
   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) // Without this if statement results are wrong for other items without win_funcs
            func->save_in_result_field(true);
        }
      }
 

a + b, win_func(a+b) over () ...
fails without that last if statement. This should be investigated further to understand the exact reason why this works, and if it covers all use cases.

Later addition:
The "if" approach is inefficient. We should try to make it such that we have the "compiled" list at setup time and then just iterate over them directly. Check MDEV-11907 fix.


Generated at Thu Feb 08 07:45:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.