From 6e492d2c82be2c7a938c4899c33650bca62e679c Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Thu, 29 Oct 2020 18:36:16 +0800 Subject: [PATCH 1/3] [td-255] --- src/tsdb/src/tsdbRead.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 5b0896ae6f..92305be714 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -2121,7 +2121,16 @@ STimeWindow changeTableGroupByLastrow(STableGroupInfo *groupList) { } } - // clear current group + // clear current group, unref unused table + for(int32_t i = 0; i < numOfTables; ++i) { + STableKeyInfo* pKeyInfo = (STableKeyInfo*) taosArrayGet(pGroup, i); + + // keyInfo.pTable may be NULL here. + if (pKeyInfo->pTable != keyInfo.pTable) { + tsdbUnRefTable(pKeyInfo->pTable); + } + } + taosArrayClear(pGroup); // more than one table in each group, only one table left for each group From 16b1e7cbf11ce6e1d101da58dfba337f5dee85cf Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 30 Oct 2020 10:47:18 +0800 Subject: [PATCH 2/3] [td-255] update sim --- .../script/general/parser/join_multivnode.sim | 61 +++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/tests/script/general/parser/join_multivnode.sim b/tests/script/general/parser/join_multivnode.sim index 5e4a0990c1..0ffb15e022 100644 --- a/tests/script/general/parser/join_multivnode.sim +++ b/tests/script/general/parser/join_multivnode.sim @@ -134,13 +134,66 @@ sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbna #1970-01-01 08:01:40.800 | 10 | 45.000000000 | 0 | true | false | 0 | #1970-01-01 08:01:40.790 | 10 | 945.000000000 | 90 | true | true | 0 | - sql select count(join_mt0.c1), sum(join_mt1.c2), first(join_mt0.c5), last(join_mt1.c7), first(join_mt1.c7) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts interval(10a) group by join_mt0.t1 order by join_mt0.ts desc limit 20 offset 19; -if $rows != 100 then +if $rows != 20 then return -1 endi -# c5 is null ! error +if $data00 != @70-01-01 08:01:40.800@ then + return -1 +endi + +if $data01 != 10 then + return -1 +endi + +if $data02 != 45.000000000 then + return -1 +endi + +if $data03 != 0 then + return -1 +endi + +if $data04 != 1 then + return -1 +endi + +if $data05 != 0 then + return -1 +endi + +if $data06 != 0 then + return -1 +endi + +if $data10 != @70-01-01 08:01:40.790@ then + return -1 +endi + +if $data11 != 10 then + return -1 +endi + +if $data12 != 945.000000000 then + return -1 +endi + +if $data13 != 90 then + return -1 +endi + +if $data14 != 1 then + return -1 +endi + +if $data15 != 1 then + return -1 +endi + +if $data16 != 0 then + return -1 +endi sql select count(join_mt0.c1), sum(join_mt0.c2)/count(*), avg(c2), first(join_mt0.c5), last(c7) from join_mt0 interval(10a) group by join_mt0.t1 order by join_mt0.ts desc; if $rows != 100 then @@ -262,4 +315,4 @@ if $data03 != 0 then return -1 endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +#system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From f311440d5d1edd3d8e7f63be41d3c0e79bb55c86 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 30 Oct 2020 10:49:14 +0800 Subject: [PATCH 3/3] [td-255] update sim --- tests/script/general/parser/join_multivnode.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/general/parser/join_multivnode.sim b/tests/script/general/parser/join_multivnode.sim index 0ffb15e022..102d5ba93f 100644 --- a/tests/script/general/parser/join_multivnode.sim +++ b/tests/script/general/parser/join_multivnode.sim @@ -315,4 +315,4 @@ if $data03 != 0 then return -1 endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file