From b1faa56f775260425051fa95162ac82125570f4e Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Sat, 20 Feb 2021 18:56:54 +0800 Subject: [PATCH 1/2] fix bug --- src/client/src/tscSubquery.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 41cfb81442..d20d133bd1 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1981,7 +1981,8 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { // set the parameters for the second round query process SSqlCmd *pPCmd = &pParent->cmd; SQueryInfo *pQueryInfo1 = tscGetQueryInfoDetail(pPCmd, 0); - + int32_t resRows = pSup->numOfRows; + if (pSup->numOfRows > 0) { SBufferWriter bw = tbufInitWriter(NULL, false); interResToBinary(&bw, pSup->pResult, pSup->tagLen); @@ -1999,6 +2000,20 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { taos_free_result(pSql); +/* + if (pSql->cmd.command == TSDB_SQL_RETRIEVE_EMPTY_RESULT) { + pParent->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; + (*pParent->fp)(pParent->param, pParent, 0); + return; + } +*/ + + if (resRows == 0) { + pParent->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; + (*pParent->fp)(pParent->param, pParent, 0); + return; + } + pQueryInfo1->round = 1; tscDoQuery(pParent); } @@ -2510,6 +2525,14 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p tscFreeRetrieveSup(pSql); // set the command flag must be after the semaphore been correctly set. + /* + if (pParentSql->cmd.command != TSDB_SQL_RETRIEVE_EMPTY_RESULT) { + pParentSql->cmd.command = TSDB_SQL_RETRIEVE_LOCALMERGE; + } else { + pParentSql->res.completed = true; + } + */ + pParentSql->cmd.command = TSDB_SQL_RETRIEVE_LOCALMERGE; if (pParentSql->res.code == TSDB_CODE_SUCCESS) { (*pParentSql->fp)(pParentSql->param, pParentSql, 0); From 377c8ae9d087bc1169e0899b267387de38873112 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Mon, 22 Feb 2021 10:14:33 +0800 Subject: [PATCH 2/2] fix bug --- src/client/src/tscSubquery.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index d20d133bd1..80138b9d74 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -2000,14 +2000,6 @@ void tscFirstRoundRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) { taos_free_result(pSql); -/* - if (pSql->cmd.command == TSDB_SQL_RETRIEVE_EMPTY_RESULT) { - pParent->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; - (*pParent->fp)(pParent->param, pParent, 0); - return; - } -*/ - if (resRows == 0) { pParent->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; (*pParent->fp)(pParent->param, pParent, 0); @@ -2525,14 +2517,6 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p tscFreeRetrieveSup(pSql); // set the command flag must be after the semaphore been correctly set. - /* - if (pParentSql->cmd.command != TSDB_SQL_RETRIEVE_EMPTY_RESULT) { - pParentSql->cmd.command = TSDB_SQL_RETRIEVE_LOCALMERGE; - } else { - pParentSql->res.completed = true; - } - */ - pParentSql->cmd.command = TSDB_SQL_RETRIEVE_LOCALMERGE; if (pParentSql->res.code == TSDB_CODE_SUCCESS) { (*pParentSql->fp)(pParentSql->param, pParentSql, 0);