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

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.
This commit is contained in:
Vicențiu Ciorbaru
2016-09-09 14:46:47 +03:00
parent ffed20c563
commit dfd3be928d
2 changed files with 390 additions and 144 deletions

View File

@@ -543,7 +543,8 @@ public:
virtual void clear()= 0;
virtual bool add()= 0;
virtual bool setup(THD *thd) { return false; }
virtual bool supports_removal() const { return false; }
virtual void remove() { DBUG_ASSERT(0); }
virtual void cleanup();
@@ -771,6 +772,11 @@ public:
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_sum_sum>(thd, mem_root, this); }
bool supports_removal() const
{
return true;
}
private:
void add_helper(bool perform_removal);
ulonglong count;
@@ -829,6 +835,11 @@ class Item_sum_count :public Item_sum_int
Item *copy_or_same(THD* thd);
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_sum_count>(thd, mem_root, this); }
bool supports_removal() const
{
return true;
}
};
@@ -878,6 +889,11 @@ public:
}
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_sum_avg>(thd, mem_root, this); }
bool supports_removal() const
{
return true;
}
};
@@ -1089,6 +1105,11 @@ public:
DBUG_ASSERT(0);
}
bool supports_removal() const
{
return true;
}
protected:
static const int NUM_BIT_COUNTERS= 64;
ulonglong reset_bits,bits;