Commit dfd3be92 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

Make cursor implementation uniform

Cursors now report their current row number as the boundary of the
partition. This is used by Frame_scan_cursor to compute aggregate
functions that do not support removal.
parent ffed20c5
...@@ -543,7 +543,8 @@ class Item_sum :public Item_func_or_sum ...@@ -543,7 +543,8 @@ class Item_sum :public Item_func_or_sum
virtual void clear()= 0; virtual void clear()= 0;
virtual bool add()= 0; virtual bool add()= 0;
virtual bool setup(THD *thd) { return false; } virtual bool setup(THD *thd) { return false; }
virtual bool supports_removal() const { return false; }
virtual void remove() { DBUG_ASSERT(0); } virtual void remove() { DBUG_ASSERT(0); }
virtual void cleanup(); virtual void cleanup();
...@@ -771,6 +772,11 @@ class Item_sum_sum :public Item_sum_num, ...@@ -771,6 +772,11 @@ class Item_sum_sum :public Item_sum_num,
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_sum_sum>(thd, mem_root, this); } { return get_item_copy<Item_sum_sum>(thd, mem_root, this); }
bool supports_removal() const
{
return true;
}
private: private:
void add_helper(bool perform_removal); void add_helper(bool perform_removal);
ulonglong count; ulonglong count;
...@@ -829,6 +835,11 @@ class Item_sum_count :public Item_sum_int ...@@ -829,6 +835,11 @@ class Item_sum_count :public Item_sum_int
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd);
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_sum_count>(thd, mem_root, this); } { return get_item_copy<Item_sum_count>(thd, mem_root, this); }
bool supports_removal() const
{
return true;
}
}; };
...@@ -878,6 +889,11 @@ class Item_sum_avg :public Item_sum_sum ...@@ -878,6 +889,11 @@ class Item_sum_avg :public Item_sum_sum
} }
Item *get_copy(THD *thd, MEM_ROOT *mem_root) Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_sum_avg>(thd, mem_root, this); } { return get_item_copy<Item_sum_avg>(thd, mem_root, this); }
bool supports_removal() const
{
return true;
}
}; };
...@@ -1089,6 +1105,11 @@ class Item_sum_bit :public Item_sum_int ...@@ -1089,6 +1105,11 @@ class Item_sum_bit :public Item_sum_int
DBUG_ASSERT(0); DBUG_ASSERT(0);
} }
bool supports_removal() const
{
return true;
}
protected: protected:
static const int NUM_BIT_COUNTERS= 64; static const int NUM_BIT_COUNTERS= 64;
ulonglong reset_bits,bits; ulonglong reset_bits,bits;
......
This diff is collapsed.
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