From d53d9eaeacce9ba96a1f0252b42864efbaa2ac10 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 10 Jan 2022 09:01:13 +0800 Subject: [PATCH] use compLen as data size when the data is not compressed --- src/client/src/tscServer.c | 7 ++++++- src/inc/taosmsg.h | 1 - src/query/src/queryMain.c | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index e65b5da923..af4c80eec1 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -2782,7 +2782,12 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) { tscSetResRawPtr(pRes, pQueryInfo, pRes->dataConverted); } - char* p = pRes->data + (ntohl(pRetrieve->resultRowSize)) * pRes->numOfRows; + char* p = NULL; + if (pRetrieve->compressed) { + p = pRetrieve->data + ntohl(pRetrieve->compLen) + pQueryInfo->fieldsInfo.numOfOutput * sizeof(int32_t); + } else { + p = pRetrieve->data + ntohl(pRetrieve->compLen); + } int32_t numOfTables = htonl(*(int32_t*)p); p += sizeof(int32_t); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 1d76fb1f87..0dd4cb5c86 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -543,7 +543,6 @@ typedef struct { typedef struct SRetrieveTableRsp { int8_t extend; int32_t numOfRows; - int32_t resultRowSize; int8_t completed; // all results are returned to client int16_t precision; int64_t offset; // updated offset value for multi-vnode projection query diff --git a/src/query/src/queryMain.c b/src/query/src/queryMain.c index 52049e2614..dc7f83d79b 100644 --- a/src/query/src/queryMain.c +++ b/src/query/src/queryMain.c @@ -402,7 +402,6 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co } (*pRsp)->numOfRows = htonl((int32_t)s); - (*pRsp)->resultRowSize = htonl(pQueryAttr->resultRowSize); if (pQInfo->code == TSDB_CODE_SUCCESS) { (*pRsp)->offset = htobe64(pQInfo->runtimeEnv.currentOffset); (*pRsp)->useconds = htobe64(pQInfo->summary.elapsedTime); @@ -434,7 +433,11 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co qDebug("QInfo:0x%"PRIx64" compress col data, uncompressed size:%d, compressed size:%d, ratio:%.2f", pQInfo->qId, origSize, compSize, (float)origSize / (float)compSize); } - (*pRsp)->compLen = htonl(compLen); + if ((*pRsp)->compressed) { + (*pRsp)->compLen = htonl(compLen); + } else { + (*pRsp)->compLen = htonl(origSize); + } pQInfo->rspContext = NULL; pQInfo->dataReady = QUERY_RESULT_NOT_READY; -- GitLab