From a17c60e129962cc081ef02428849eba04f60e38a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 1 Jan 2021 15:24:51 +0800 Subject: [PATCH] [TD-225]fix compiler error. --- src/client/src/tscServer.c | 6 +++--- src/inc/taosmsg.h | 1 + src/query/src/qExecutor.c | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index b1050a9bff..4ffe666be6 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 79cfc6f86c..bf246ff3d1 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 291f7ca337..ac087e2963 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); -- GitLab