diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 7c3e74ec20..44b225930c 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -8864,6 +8864,10 @@ bool checkNeedToCompressQueryCol(SQInfo *pQInfo) { SSDataBlock* pRes = pRuntimeEnv->outputBuf; + if (GET_NUM_OF_RESULTS(&(pQInfo->runtimeEnv)) <= 0) { + return false; + } + int32_t numOfRows = pQueryAttr->pExpr2 ? GET_NUM_OF_RESULTS(pRuntimeEnv) : pRes->info.rows; int32_t numOfCols = pQueryAttr->pExpr2 ? pQueryAttr->numOfExpr2 : pQueryAttr->numOfOutput; diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index b1a029f46c..ab63d863bc 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -357,7 +357,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co } (*pRsp)->precision = htons(pQueryAttr->precision); - (*pRsp)->compressed = checkNeedToCompressQueryCol(pQInfo); + (*pRsp)->compressed = (int8_t)checkNeedToCompressQueryCol(pQInfo); if (GET_NUM_OF_RESULTS(&(pQInfo->runtimeEnv)) > 0 && pQInfo->code == TSDB_CODE_SUCCESS) { doDumpQueryResult(pQInfo, (*pRsp)->data, (*pRsp)->compressed, &compLen);