diff options
author | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2016-02-16 00:33:53 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <cvicentiu@gmail.com> | 2016-02-16 00:43:57 +0200 |
commit | 0c223a96c12689157894c09f91aa2a5500937afb (patch) | |
tree | cf7c0be42543d4903ed49f4c909ce1cee23511c3 /sql | |
parent | 9a673e0a88cf7ab5eba8115edbd66d479ad38764 (diff) | |
download | mariadb-git-0c223a96c12689157894c09f91aa2a5500937afb.tar.gz |
Fix review comments.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_windowfunc.cc | 13 | ||||
-rw-r--r-- | sql/item_windowfunc.h | 11 |
2 files changed, 16 insertions, 8 deletions
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc index 488e9ad66a6..fbe9a728765 100644 --- a/sql/item_windowfunc.cc +++ b/sql/item_windowfunc.cc @@ -36,7 +36,8 @@ Item_window_func::fix_fields(THD *thd, Item **ref) void Item_window_func::setup_partition_border_check(THD *thd) { - for (ORDER * curr = window_spec->partition_list.first; curr; curr=curr->next) { + for (ORDER *curr= window_spec->partition_list.first; curr; curr=curr->next) + { //curr->item_ptr->fix_fields(thd, curr->item); Cached_item *tmp= new_Cached_item(thd, curr->item[0], TRUE); partition_fields.push_back(tmp); @@ -48,7 +49,8 @@ void Item_window_func::setup_partition_border_check(THD *thd) void Item_sum_rank::setup_window_func(THD *thd, Window_spec *window_spec) { /* TODO: move this into Item_window_func? */ - for (ORDER *curr = window_spec->order_list.first; curr; curr=curr->next) { + for (ORDER *curr= window_spec->order_list.first; curr; curr=curr->next) + { Cached_item *tmp= new_Cached_item(thd, curr->item[0], TRUE); orderby_fields.push_back(tmp); } @@ -58,7 +60,8 @@ void Item_sum_rank::setup_window_func(THD *thd, Window_spec *window_spec) void Item_sum_dense_rank::setup_window_func(THD *thd, Window_spec *window_spec) { /* TODO: consider moving this && Item_sum_rank's implementation */ - for (ORDER *curr = window_spec->order_list.first; curr; curr=curr->next) { + for (ORDER *curr= window_spec->order_list.first; curr; curr=curr->next) + { Cached_item *tmp= new_Cached_item(thd, curr->item[0], TRUE); orderby_fields.push_back(tmp); } @@ -90,10 +93,10 @@ void Item_window_func::advance_window() { int changed = test_if_group_changed(partition_fields); - if (changed > -1) { + if (changed > -1) + { /* Next partition */ window_func->clear(); } window_func->add(); } - diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 7db98872b3a..202b0db406e 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -157,13 +157,18 @@ class Item_sum_dense_rank: public Item_sum_int { longlong dense_rank; List<Cached_item> orderby_fields; - /* TODO: implementation is missing */ - void clear() { + /* + XXX(cvicentiu) This class could potentially be implemented in the rank + class, with a switch for the DENSE case. + */ + void clear() + { dense_rank= 1; } bool add(); void update_field() {} - longlong val_int() { + longlong val_int() + { return dense_rank; } |