mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF , window functions and views
Adding destructor for Group_bound_tracker to free Cached_item_str. The Cached_item for window functions are allocated on THD:mem_root but the Cached_item_str has value of type string which is allocated on the heap, so we need to call free() for it
This commit is contained in:
parent
aa83b9cf4f
commit
7906bee67b
3 changed files with 47 additions and 8 deletions
|
@ -3607,5 +3607,32 @@ b row_number() over (partition by sum(a)+1)
|
|||
2000 1
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF,
|
||||
# window functions and views
|
||||
#
|
||||
create table t1 (id int, n1 int);
|
||||
insert into t1 values (1,1),(2,1),(3,2),(4,4);
|
||||
explain
|
||||
select max(n1) over (partition by 'abc') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary
|
||||
select max(n1) over (partition by 'abc') from t1;
|
||||
max(n1) over (partition by 'abc')
|
||||
4
|
||||
4
|
||||
4
|
||||
4
|
||||
explain
|
||||
select rank() over (partition by 'abc' order by 'xyz') from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary
|
||||
select rank() over (partition by 'abc' order by 'xyz') from t1;
|
||||
rank() over (partition by 'abc' order by 'xyz')
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
|
|
|
@ -2325,6 +2325,22 @@ select b, row_number() over (partition by sum(a)+1) from t1 group by b;
|
|||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18015: Assertion `global_status_var.global_memory_used == 0' failed when using UDF,
|
||||
--echo # window functions and views
|
||||
--echo #
|
||||
|
||||
create table t1 (id int, n1 int);
|
||||
insert into t1 values (1,1),(2,1),(3,2),(4,4);
|
||||
explain
|
||||
select max(n1) over (partition by 'abc') from t1;
|
||||
select max(n1) over (partition by 'abc') from t1;
|
||||
|
||||
explain
|
||||
select rank() over (partition by 'abc' order by 'xyz') from t1;
|
||||
select rank() over (partition by 'abc' order by 'xyz') from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
|
|
@ -28,11 +28,6 @@ public:
|
|||
first_check= true;
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
group_fields.empty();
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the current row is in a different group than the previous row
|
||||
this function was called for.
|
||||
|
@ -70,6 +65,10 @@ public:
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
~Group_bound_tracker()
|
||||
{
|
||||
group_fields.delete_elements();
|
||||
}
|
||||
|
||||
private:
|
||||
List<Cached_item> group_fields;
|
||||
|
@ -199,7 +198,6 @@ public:
|
|||
{
|
||||
if (peer_tracker)
|
||||
{
|
||||
peer_tracker->cleanup();
|
||||
delete peer_tracker;
|
||||
peer_tracker= NULL;
|
||||
}
|
||||
|
@ -269,7 +267,6 @@ class Item_sum_dense_rank: public Item_sum_int
|
|||
{
|
||||
if (peer_tracker)
|
||||
{
|
||||
peer_tracker->cleanup();
|
||||
delete peer_tracker;
|
||||
peer_tracker= NULL;
|
||||
}
|
||||
|
@ -537,7 +534,6 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
|
|||
{
|
||||
if (peer_tracker)
|
||||
{
|
||||
peer_tracker->cleanup();
|
||||
delete peer_tracker;
|
||||
peer_tracker= NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue