From 5b81cd8093498deb58fddd3613462708ad093e66 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 10 Mar 2021 14:50:47 +0800 Subject: [PATCH] fix bug --- src/client/src/tscSubquery.c | 7 +++++++ tests/script/general/parser/groupby.sim | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 78e9c68290..6dca3f9059 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1880,6 +1880,13 @@ void doAppendData(SInterResult* pInterResult, TAOS_ROW row, int32_t numOfCols, S } } + if (p && taosArrayGetSize(p) > 0) { + SResPair *l = taosArrayGetLast(p); + if (l->key == key && key == INT64_MIN) { + continue; + } + } + //append a new column if (p == NULL) { SStddevInterResult t = {.colId = id, .pResult = taosArrayInit(10, sizeof(SResPair)),}; diff --git a/tests/script/general/parser/groupby.sim b/tests/script/general/parser/groupby.sim index a83c975be2..dd7331054c 100644 --- a/tests/script/general/parser/groupby.sim +++ b/tests/script/general/parser/groupby.sim @@ -610,6 +610,11 @@ print =================>TD-2665 sql_error create table txx as select avg(c) as t from st; sql_error create table txx1 as select avg(c) as t from t1; +sql select stddev(c),stddev(c) from st group by c; +if $rows != 4 then + return -1 +endi + print =================>TD-2236 sql select first(ts),last(ts) from t1 group by c; if $rows != 4 then -- GitLab