Commit 0c223a96 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

Fix review comments.

parent 9a673e0a
......@@ -135,3 +135,4 @@ pk a b rank() over (partition by b order by a) dense_rank() over (partition by b
7 2 20 1 1
9 4 20 4 2
10 4 20 4 2
drop table t3;
......@@ -109,5 +109,4 @@ insert into t3 values
select pk, a, b, rank() over (order by a), dense_rank() over (order by a) from t3;
select pk, a, b, rank() over (partition by b order by a), dense_rank() over (partition by b order by a) from t3;
drop table tr;
drop table t3;
......@@ -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();
}
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment