diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-05-24 17:06:53 -0600 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-05-24 17:06:53 -0600 |
commit | b7b409b76ee4c2817a882b3f08cb30890dd8532a (patch) | |
tree | 0556f9414f47140d32040504811d813034d86f7d /sql/item_sum.h | |
parent | a895b7b447e3b8749f9f14447f2cb72e7d062546 (diff) | |
download | mariadb-git-b7b409b76ee4c2817a882b3f08cb30890dd8532a.tar.gz |
handle tree overflow in count(distinct)
test heap table/tree overflow in count(distinct)
mysql-test/r/count_distinct2.result:
added test for tree/heap table overflow
mysql-test/t/count_distinct2.test:
test tree/heap table overflow
sql/item_sum.cc:
handle tree overflow in count(distinct)
sql/item_sum.h:
t
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r-- | sql/item_sum.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h index 863623c3b1a..1aa7f78d786 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -148,15 +148,26 @@ class Item_sum_count_distinct :public Item_sum_int bool fix_fields(THD *thd,TABLE_LIST *tables); TMP_TABLE_PARAM *tmp_table_param; TREE tree; - bool use_tree; // If there are no blobs, we can use a tree, which + uint max_elements_in_tree; + // calculated based on max_heap_table_size. If reached, + // walk the tree and dump it into MyISAM table + + bool use_tree; + // If there are no blobs, we can use a tree, which // is faster than heap table. In that case, we still use the table // to help get things set up, but we insert nothing in it - int rec_offset; // the first few bytes of record ( at least one) + + int rec_offset; + // the first few bytes of record ( at least one) // are just markers for deleted and NULLs. We want to skip them since // they will just bloat the tree without providing any valuable info - friend int composite_key_cmp(void* arg, byte* key1, byte* key2); + int tree_to_myisam(); + friend int composite_key_cmp(void* arg, byte* key1, byte* key2); + friend int dump_leaf(byte* key, uint32 count __attribute__((unused)), + Item_sum_count_distinct* item); + public: Item_sum_count_distinct(List<Item> &list) :Item_sum_int(list),table(0),used_table_cache(~(table_map) 0), |