diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index defb49c5733534c94352cf9e0ea1a2951a421e78..ef9ca9de36950f092aa555ed5b17a979329726cf 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -332,7 +332,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) { rpcMsg->code = (*tscProcessMsgRsp[pCmd->command])(pSql); if (rpcMsg->code != TSDB_CODE_ACTION_IN_PROGRESS) { - rpcMsg->code = pRes->code ? pRes->code : pRes->numOfRows; + rpcMsg->code = (pRes->code == TSDB_CODE_SUCCESS) ? pRes->numOfRows: pRes->code; tscTrace("%p SQL result:%s res:%p", pSql, tstrerror(pRes->code), pSql); bool shouldFree = tscShouldBeFreed(pSql); @@ -2330,7 +2330,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) { } pRes->row = 0; - tscTrace("%p numOfRows:%d, offset:%d", pSql, pRes->numOfRows, pRes->offset); + tscTrace("%p numOfRows:%d, offset:%d, complete:%d", pSql, pRes->numOfRows, pRes->offset, pRes->completed); return 0; } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 1fdbd43408ea0c0cfd1267def6fed1a309c2233d..df943d68a4a4d67f6535a62a73b96f5a36766299 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1557,8 +1557,8 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR assert(pRes->numOfRows == numOfRows); int64_t num = atomic_add_fetch_64(&pState->numOfRetrievedRows, numOfRows); -// tscTrace("%p sub:%p retrieve numOfRows:%d totalNumOfRows:%d from ip:%u,vid:%d,orderOfSub:%d", pPObj, pSql, -// pRes->numOfRows, pState->numOfRetrievedRows, pSvd->ip, pSvd->vnode, idx); + tscTrace("%p sub:%p retrieve numOfRows:%d totalNumOfRows:%d from ip:%s, orderOfSub:%d", pPObj, pSql, + pRes->numOfRows, pState->numOfRetrievedRows, pSql->ipList.fqdn[pSql->ipList.inUse], idx); if (num > tsMaxNumOfOrderedResults && tscIsProjectionQueryOnSTable(pQueryInfo, 0)) { tscError("%p sub:%p num of OrderedRes is too many, max allowed:%" PRId64 " , current:%" PRId64, @@ -1713,6 +1713,11 @@ static void multiVnodeInsertMerge(void* param, TAOS_RES* tres, int numOfRows) { // increase the total inserted rows if (numOfRows > 0) { pParentObj->res.numOfRows += numOfRows; + } else { + SSqlObj* pSql = (SSqlObj*) tres; + assert(pSql != NULL && pSql->res.code == numOfRows); + + pParentObj->res.code = pSql->res.code; } taos_free_result(tres); @@ -1947,7 +1952,8 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - for (int i = 0; i < tscNumOfFields(pQueryInfo); ++i) { + size_t size = tscNumOfFields(pQueryInfo); + for (int i = 0; i < size; ++i) { SFieldSupInfo* pSup = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, i); if (pSup->pSqlExpr != NULL) { tscGetResultColumnChr(pRes, &pQueryInfo->fieldsInfo, i);