diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index ebf29e9bb8377fccffdb495db6646e78ab9c0db8..9ba29783954173d43a83305fd01bd81e54255eba 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6385,27 +6385,27 @@ SQInfo* createQInfoImpl(SQueryTableMsg* pQueryMsg, SSqlGroupbyExpr* pGroupbyExpr } } + for (int16_t col = 0; col < numOfOutput; ++col) { + assert(pExprs[col].bytes > 0); + pQuery->resultRowSize += pExprs[col].bytes; + + // keep the tag length + if (TSDB_COL_IS_TAG(pExprs[col].base.colInfo.flag)) { + pQuery->tagLen += pExprs[col].bytes; + } + } + if (pSecExprs != NULL) { + int32_t resultRowSize = 0; + // calculate the result row size for (int16_t col = 0; col < pQuery->numOfExpr2; ++col) { assert(pSecExprs[col].bytes > 0); - pQuery->resultRowSize += pSecExprs[col].bytes; - - // keep the tag length - if (TSDB_COL_IS_TAG(pSecExprs[col].base.colInfo.flag)) { - pQuery->tagLen += pSecExprs[col].bytes; - } + resultRowSize += pSecExprs[col].bytes; } - } else { - // calculate the result row size - for (int16_t col = 0; col < numOfOutput; ++col) { - assert(pExprs[col].bytes > 0); - pQuery->resultRowSize += pExprs[col].bytes; - // keep the tag length - if (TSDB_COL_IS_TAG(pExprs[col].base.colInfo.flag)) { - pQuery->tagLen += pExprs[col].bytes; - } + if (resultRowSize > pQuery->resultRowSize) { + pQuery->resultRowSize = resultRowSize; } }