1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Convert if statements to switch case.

This commit is contained in:
Vicențiu Ciorbaru
2016-02-28 22:00:00 +02:00
parent 1cc6fd1f00
commit f638ffef2c
2 changed files with 25 additions and 22 deletions

View File

@@ -372,5 +372,4 @@ public:
}; };
#endif /* ITEM_WINDOWFUNC_INCLUDED */ #endif /* ITEM_WINDOWFUNC_INCLUDED */

View File

@@ -886,9 +886,10 @@ bool JOIN::process_window_functions(List<Item> *curr_fields_list)
item_win->setup_partition_border_check(thd); item_win->setup_partition_border_check(thd);
Item_sum::Sumfunctype type= item_win->window_func->sum_func(); Item_sum::Sumfunctype type= item_win->window_func->sum_func();
if (type == Item_sum::ROW_NUMBER_FUNC || switch (type) {
type == Item_sum::RANK_FUNC || case Item_sum::ROW_NUMBER_FUNC:
type == Item_sum::DENSE_RANK_FUNC) case Item_sum::RANK_FUNC:
case Item_sum::DENSE_RANK_FUNC:
{ {
/* /*
One-pass window function computation, walk through the rows and One-pass window function computation, walk through the rows and
@@ -896,18 +897,21 @@ bool JOIN::process_window_functions(List<Item> *curr_fields_list)
*/ */
if (compute_window_func_values(item_win, tbl, &info)) if (compute_window_func_values(item_win, tbl, &info))
is_error= true; is_error= true;
break;
} }
else if (type == Item_sum::COUNT_FUNC) case Item_sum::COUNT_FUNC:
{ {
/* /*
Frame-aware window function computation. It does one pass, but Frame-aware window function computation. It does one pass, but
uses three cursors -frame_top, current_row, and frame_bottom. uses three cursors -frame_start, current_row, and frame_end.
*/ */
if (compute_window_func_with_frames(item_win, tbl, &info)) if (compute_window_func_with_frames(item_win, tbl, &info))
is_error= true; is_error= true;
break;
} }
else default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
}
item_win->set_read_value_from_result_field(); item_win->set_read_value_from_result_field();
/* This calls filesort_free_buffers(): */ /* This calls filesort_free_buffers(): */