MCPcopy Create free account
hub / github.com/MariaDB/server / exec

Method exec

sql/sql_window.cc:3060–3092  ·  view source on GitHub ↗

Compute the value of window function for all rows. */

Source from the content-addressed store, hash-verified

3058 Compute the value of window function for all rows.
3059*/
3060bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result)
3061{
3062 List_iterator_fast<Item_window_func> it(window_functions);
3063 Item_window_func *win_func;
3064 while ((win_func= it++))
3065 {
3066 win_func->set_phase_to_computation();
3067 // TODO(cvicentiu) Setting the aggregator should probably be done during
3068 // setup of Window_funcs_sort.
3069 win_func->window_func()->set_aggregator(thd,
3070 Aggregator::SIMPLE_AGGREGATOR);
3071 }
3072 it.rewind();
3073
3074 List<Cursor_manager> cursor_managers;
3075 if (get_window_functions_required_cursors(thd, window_functions,
3076 &cursor_managers))
3077 return true;
3078
3079 /* Go through the sorted array and compute the window function */
3080 bool is_error= compute_window_func(thd,
3081 window_functions,
3082 cursor_managers,
3083 tbl, filesort_result);
3084 while ((win_func= it++))
3085 {
3086 win_func->set_phase_to_retrieval();
3087 }
3088
3089 cursor_managers.delete_elements();
3090
3091 return is_error;
3092}
3093
3094
3095bool Window_funcs_sort::exec(JOIN *join, bool keep_filesort_result)

Callers

nothing calls this directly

Calls 10

compute_window_funcFunction · 0.85
create_sort_indexFunction · 0.85
set_aggregatorMethod · 0.80
window_funcMethod · 0.80
total_join_tab_cntMethod · 0.80
rewindMethod · 0.45
delete_elementsMethod · 0.45

Tested by

no test coverage detected