diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index f8c072a23912f9451785a19f13b4950c1fead629..953914c50491db0eb0bc2d7f417e1ca390cdd171 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -621,7 +621,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql, int32_t clauseIndex) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, clauseIndex); int32_t srcColListSize = (int32_t)(taosArrayGetSize(pQueryInfo->colList) * sizeof(SColumnInfo)); - + int32_t srcColFilterSize = tscGetColFilterSerializeLen(pQueryInfo); size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo); int32_t exprSize = (int32_t)(sizeof(SSqlFuncMsg) * numOfExprs * 2); @@ -643,8 +643,8 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql, int32_t clauseIndex) { tableSerialize = totalTables * sizeof(STableIdInfo); } - return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + exprSize + tsBufSize + - tableSerialize + sqlLen + 4096 + pQueryInfo->bufLen; + return MIN_QUERY_MSG_PKT_SIZE + minMsgSize() + sizeof(SQueryTableMsg) + srcColListSize + srcColFilterSize + + exprSize + tsBufSize + tableSerialize + sqlLen + 4096 + pQueryInfo->bufLen; } static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char *pMsg, int32_t *succeed) { @@ -1099,7 +1099,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCond *pCond = tsGetSTableQueryCond(pTagCond, pTableMeta->id.uid); if (pCond != NULL && pCond->cond != NULL) { - pQueryMsg->tagCondLen = htons(pCond->len); + pQueryMsg->tagCondLen = htonl(pCond->len); memcpy(pMsg, pCond->cond, pCond->len); pMsg += pCond->len; diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 773243891fb06d7effac9a6f09dc27df2956b9c4..5e59f54c8898d61b64109ed699d1431723553878 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -2989,4 +2989,20 @@ STableMeta* tscTableMetaDup(STableMeta* pTableMeta) { return p; } +int32_t tscGetColFilterSerializeLen(SQueryInfo* pQueryInfo) { + int16_t numOfCols = (int16_t)taosArrayGetSize(pQueryInfo->colList); + int32_t len = 0; + + for(int32_t i = 0; i < numOfCols; ++i) { + SColumn* pCol = taosArrayGetP(pQueryInfo->colList, i); + for (int32_t j = 0; j < pCol->numOfFilters; ++j) { + SColumnFilterInfo *pColFilter = &pCol->filterInfo[j]; + len += sizeof(SColumnFilterInfo); + if (pColFilter->filterstr) { + len += (int32_t)pColFilter->len + 1; + } + } + } + return len; +} diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index d7ac7dd277c0487b97096821753c904da137e534..2d782108440971d31af16ffeb1a6d5f2a2dc205c 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -494,7 +494,7 @@ typedef struct { int16_t numOfCols; // the number of columns will be load from vnode SInterval interval; SSessionWindow sw; // session window - uint16_t tagCondLen; // tag length in current query + uint32_t tagCondLen; // tag length in current query uint32_t tbnameCondLen; // table name filter condition string length int16_t numOfGroupCols; // num of group by columns int16_t orderByIdx; diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 6b32508f0761a273ca583e14e8349d4d3b01c109..f96d33f060dc7707890e020ee6a5e5d4dc5d1518 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6172,7 +6172,7 @@ int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SQueryParam* param) { pQueryMsg->numOfCols = htons(pQueryMsg->numOfCols); pQueryMsg->numOfOutput = htons(pQueryMsg->numOfOutput); pQueryMsg->numOfGroupCols = htons(pQueryMsg->numOfGroupCols); - pQueryMsg->tagCondLen = htons(pQueryMsg->tagCondLen); + pQueryMsg->tagCondLen = htonl(pQueryMsg->tagCondLen); pQueryMsg->tsOffset = htonl(pQueryMsg->tsOffset); pQueryMsg->tsLen = htonl(pQueryMsg->tsLen); pQueryMsg->tsNumOfBlocks = htonl(pQueryMsg->tsNumOfBlocks);