Skip to content

Commit dfd3be9

Browse files
committed
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.
1 parent ffed20c commit dfd3be9

File tree

2 files changed

+387
-141
lines changed

2 files changed

+387
-141
lines changed

sql/item_sum.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,8 @@ class Item_sum :public Item_func_or_sum
543543
virtual void clear()= 0;
544544
virtual bool add()= 0;
545545
virtual bool setup(THD *thd) { return false; }
546-
546+
547+
virtual bool supports_removal() const { return false; }
547548
virtual void remove() { DBUG_ASSERT(0); }
548549

549550
virtual void cleanup();
@@ -771,6 +772,11 @@ class Item_sum_sum :public Item_sum_num,
771772
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
772773
{ return get_item_copy<Item_sum_sum>(thd, mem_root, this); }
773774

775+
bool supports_removal() const
776+
{
777+
return true;
778+
}
779+
774780
private:
775781
void add_helper(bool perform_removal);
776782
ulonglong count;
@@ -829,6 +835,11 @@ class Item_sum_count :public Item_sum_int
829835
Item *copy_or_same(THD* thd);
830836
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
831837
{ return get_item_copy<Item_sum_count>(thd, mem_root, this); }
838+
839+
bool supports_removal() const
840+
{
841+
return true;
842+
}
832843
};
833844

834845

@@ -878,6 +889,11 @@ class Item_sum_avg :public Item_sum_sum
878889
}
879890
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
880891
{ return get_item_copy<Item_sum_avg>(thd, mem_root, this); }
892+
893+
bool supports_removal() const
894+
{
895+
return true;
896+
}
881897
};
882898

883899

@@ -1089,6 +1105,11 @@ class Item_sum_bit :public Item_sum_int
10891105
DBUG_ASSERT(0);
10901106
}
10911107

1108+
bool supports_removal() const
1109+
{
1110+
return true;
1111+
}
1112+
10921113
protected:
10931114
static const int NUM_BIT_COUNTERS= 64;
10941115
ulonglong reset_bits,bits;

0 commit comments

Comments
 (0)