diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 119a84e964f70bfa061d1b245e483eaf2210dd25..8efe89d28ab497ea7a442b412845d9b54172dce6 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -492,13 +492,15 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pMsg += sizeof(pQueryInfo->type); // todo valid the vgroupId at the client side - if (UTIL_TABLE_IS_SUPERTABLE(pQueryInfo->pTableMetaInfo[0])) { - SVgroupsInfo* pVgroupInfo = pQueryInfo->pTableMetaInfo[0]->vgroupList; - assert(pVgroupInfo->numOfVgroups == 1); // todo fix me + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + + if (UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) { + int32_t vgIndex = pTableMetaInfo->vgroupIndex; - pRetrieveMsg->header.vgId = htonl(pVgroupInfo->vgroups[0].vgId); + SVgroupsInfo* pVgroupInfo = pTableMetaInfo->vgroupList; + pRetrieveMsg->header.vgId = htonl(pVgroupInfo->vgroups[vgIndex].vgId); } else { - STableMeta* pTableMeta = pQueryInfo->pTableMetaInfo[0]->pTableMeta; + STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; pRetrieveMsg->header.vgId = htonl(pTableMeta->vgroupInfo.vgId); } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index f125fa8e6a2051fbfd3857e59fc408956dacbe6c..7a1c08d0563ecabd9d4a3cbd00ea622d8e5fe02b 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1450,7 +1450,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO } // all subqueries are failed - tscError("%p retrieve from %d vnode(s) completed,code:%d.FAILED.", pPObj, pState->numOfTotal, pState->code); + tscError("%p retrieve from %d vnode(s) completed,code:%s.FAILED.", pPObj, pState->numOfTotal, tstrerror(pState->code)); pPObj->res.code = pState->code; // release allocated resource diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index dd3cb76cbf40876718786dae14dbb5a7b263d8c7..00afb977fd9390e9f063a0dd72a9ac74073d3c9f 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1675,10 +1675,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST pTableMetaInfo->pTableMeta = pTableMeta; if (vgroupList != NULL) { - assert(vgroupList->numOfVgroups == 1); // todo fix me - size_t size = sizeof(SVgroupsInfo) + sizeof(SCMVgroupInfo) * vgroupList->numOfVgroups; - pTableMetaInfo->vgroupList = malloc(size); memcpy(pTableMetaInfo->vgroupList, vgroupList, size); } diff --git a/src/query/src/queryExecutor.c b/src/query/src/queryExecutor.c index 8a31b02ddafcae9c1cd78126ee96706b0c263259..52cfa582d080fed6816fd32f3d9457f5a946e851 100644 --- a/src/query/src/queryExecutor.c +++ b/src/query/src/queryExecutor.c @@ -3277,11 +3277,11 @@ static SQueryStatusInfo getQueryStatusInfo(SQueryRuntimeEnv *pRuntimeEnv) { STableQueryInfo* pTableQueryInfo = pQuery->current; SQueryStatusInfo info = { - .status = pQuery->status, + .status = pQuery->status, .windowIndex = pRuntimeEnv->windowResInfo.curIndex, - .lastKey = pTableQueryInfo->lastKey, - .w = pQuery->window, - .curWindow = {.skey = pTableQueryInfo->lastKey, .ekey = pQuery->window.ekey}, + .lastKey = pTableQueryInfo->lastKey, + .w = pQuery->window, + .curWindow = {.skey = pTableQueryInfo->lastKey, .ekey = pTableQueryInfo->win.ekey}, }; return info; @@ -3306,7 +3306,7 @@ static void setEnvBeforeReverseScan(SQueryRuntimeEnv *pRuntimeEnv, SQueryStatusI STsdbQueryCond cond = { .twindow = pQuery->window, - .order = pQuery->order.order, + .order = pQuery->order.order, .colList = pQuery->colList, .numOfCols = pQuery->numOfCols, }; @@ -4499,6 +4499,9 @@ static void sequentialTableProcess(SQInfo *pQInfo) { initCtxOutputBuf(pRuntimeEnv); setTagVal(pRuntimeEnv, (STableId*) taosArrayGet(tx, 0), pQInfo->tsdb); + + // here we simply set the first table as current table + pRuntimeEnv->pQuery->current = ((SGroupItem*) taosArrayGet(group, 0))->info; scanAllDataBlocks(pRuntimeEnv); int64_t numOfRes = getNumOfResult(pRuntimeEnv);