diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index b1050a9bff3fc4a9f1a099412afd138f0fd8aab3..4ffe666be6e5a765cc3754d275f869b04052fbef 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -730,7 +730,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pQueryMsg->interval.offsetUnit = pQueryInfo->interval.offsetUnit; pQueryMsg->numOfGroupCols = htons(pQueryInfo->groupbyExpr.numOfGroupCols); pQueryMsg->tagNameRelType = htons(pQueryInfo->tagCond.relType); - pQueryMsg->tagCondLen = htons((pQueryInfo->tagCond.tbnameCond.cond != NULL)? strlen(pQueryInfo->tagCond.tbnameCond.cond):0); + pQueryMsg->tbnameCondLen = htons((pQueryInfo->tagCond.tbnameCond.cond != NULL)? strlen(pQueryInfo->tagCond.tbnameCond.cond):0); pQueryMsg->numOfTags = htonl(numOfTags); pQueryMsg->queryType = htonl(pQueryInfo->type); pQueryMsg->vgroupLimit = htobe64(pQueryInfo->vgroupLimit); @@ -970,10 +970,10 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } if (pQueryInfo->tagCond.tbnameCond.cond == NULL) { - assert(pQueryMsg->tagCondLen == 0); + assert(pQueryMsg->tbnameCondLen == 0); } else { strcpy(pMsg, pQueryInfo->tagCond.tbnameCond.cond); - pMsg += strlen(pQueryInfo->tagCond.tbnameCond.cond) + 1; + pMsg += pQueryMsg->tbnameCondLen + 1; } // compressed ts block diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 79cfc6f86c09099883427357b86ffdde43b734f5..bf246ff3d1cb48924e3ab53aa37afe52f11a5245 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -476,6 +476,7 @@ typedef struct { int16_t numOfCols; // the number of columns will be load from vnode SInterval interval; uint16_t tagCondLen; // tag length in current query + uint16_t tbnameCondLen; // table name filter condition string length int16_t numOfGroupCols; // num of group by columns int16_t orderByIdx; int16_t orderType; // used in group by xx order by xxx diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 291f7ca33798a042e2ba9787996b6685dc93fb33..ac087e296308c60dae0face4b905402bebc584d4 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6034,7 +6034,7 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList, pQueryMsg->tsNumOfBlocks = htonl(pQueryMsg->tsNumOfBlocks); pQueryMsg->tsOrder = htonl(pQueryMsg->tsOrder); pQueryMsg->numOfTags = htonl(pQueryMsg->numOfTags); - pQueryMsg->tagCondLen = htonl(pQueryMsg->tagCondLen); + pQueryMsg->tbnameCondLen = htons(pQueryMsg->tbnameCondLen); pQueryMsg->secondStageOutput = htonl(pQueryMsg->secondStageOutput); pQueryMsg->sqlstrLen = htonl(pQueryMsg->sqlstrLen); @@ -6247,15 +6247,15 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList, pMsg += pQueryMsg->tagCondLen; } - if (pQueryMsg->tagCondLen != 0) { - *tbnameCond = calloc(1, pQueryMsg->tagCondLen + 1); + if (pQueryMsg->tbnameCondLen > 0) { + *tbnameCond = calloc(1, pQueryMsg->tbnameCondLen + 1); if (*tbnameCond == NULL) { code = TSDB_CODE_QRY_OUT_OF_MEMORY; goto _cleanup; } - strncpy(*tbnameCond, pMsg, pQueryMsg->tagCondLen); - pMsg += pQueryMsg->tagCondLen; + strncpy(*tbnameCond, pMsg, pQueryMsg->tbnameCondLen); + pMsg += pQueryMsg->tbnameCondLen; } *sql = strndup(pMsg, pQueryMsg->sqlstrLen);