From a802d35af49f5ee7c5646607a4659b787f942dcd Mon Sep 17 00:00:00 2001 From: slzhou Date: Thu, 21 Dec 2023 16:36:56 +0800 Subject: [PATCH] fix: change the pre-allocated column check --- source/libs/executor/src/scanoperator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index d24b01db2c..b29d707cc9 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3274,21 +3274,21 @@ static int32_t blockRowToBuf(SSDataBlock* pBlock, int32_t rowIdx, char* buf) { isNull[i] = 0; char* pData = colDataGetData(pCol, rowIdx); if (pCol->info.type == TSDB_DATA_TYPE_JSON) { - if (colDataGetLength(pCol, blockDataGetNumOfRows(pBlock)) != 0) { + if (pCol->pData) { int32_t dataLen = getJsonValueLen(pData); memcpy(pStart, pData, dataLen); pStart += dataLen; } else { - // the column that is pre-allocated, has no data and has offset + // the column that is pre-allocated has no data and has offset *pStart = 0; pStart += 1; } } else if (IS_VAR_DATA_TYPE(pCol->info.type)) { - if (colDataGetLength(pCol, blockDataGetNumOfRows(pBlock)) != 0) { + if (pCol->pData) { varDataCopy(pStart, pData); pStart += varDataTLen(pData); } else { - // the column that is pre-allocated, has no data and has offset + // the column that is pre-allocated has no data and has offset *(VarDataLenT*)(pStart) = 0; pStart += VARSTR_HEADER_SIZE; }