From 878bb18d086d1aec2a0731e304b23dcaf8f2ceb8 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 27 Apr 2022 19:59:50 +0800 Subject: [PATCH] fix(query): the null value is missing when merging two SColumnInfoData. --- source/common/src/tdatablock.c | 10 +++++++--- source/libs/executor/src/executorimpl.c | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 63e009ed0a..f30a74bf11 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -225,12 +225,16 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co // Handle the bitmap char* p = taosMemoryRealloc(pColumnInfoData->varmeta.offset, sizeof(int32_t) * (numOfRow1 + numOfRow2)); if (p == NULL) { - // TODO + return TSDB_CODE_OUT_OF_MEMORY; } pColumnInfoData->varmeta.offset = (int32_t*)p; for (int32_t i = 0; i < numOfRow2; ++i) { - pColumnInfoData->varmeta.offset[i + numOfRow1] = pSource->varmeta.offset[i] + pColumnInfoData->varmeta.length; + if (pSource->varmeta.offset[i] == -1) { + pColumnInfoData->varmeta.offset[i + numOfRow1] = -1; + } else { + pColumnInfoData->varmeta.offset[i + numOfRow1] = pSource->varmeta.offset[i] + pColumnInfoData->varmeta.length; + } } // copy data @@ -239,7 +243,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co if (pColumnInfoData->varmeta.allocLen < len + oldLen) { char* tmp = taosMemoryRealloc(pColumnInfoData->pData, len + oldLen); if (tmp == NULL) { - return TSDB_CODE_VND_OUT_OF_MEMORY; + return TSDB_CODE_OUT_OF_MEMORY; } pColumnInfoData->pData = tmp; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 1da0409fb8..51f11b20ac 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -5005,6 +5005,7 @@ static int32_t handleLimitOffset(SOperatorInfo* pOperator, SSDataBlock* pBlock) return PROJECT_RETRIEVE_DONE; } + // todo optimize performance // If there are slimit/soffset value exists, multi-round result can not be packed into one group, since the // they may not belong to the same group the limit/offset value is not valid in this case. if (pRes->info.rows >= pOperator->resultInfo.threshold || pProjectInfo->slimit.offset != -1 || pProjectInfo->slimit.limit != -1) {