From 3341d02060e221f7b1537a7527daf4f09ac98cee Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Thu, 22 Feb 2024 17:03:17 +0800 Subject: [PATCH] fix: don't copy all data when use limit --- source/common/src/tdatablock.c | 1 + source/libs/executor/src/executor.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 9439c172c4..690eda17e1 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1688,6 +1688,7 @@ int32_t blockDataTrimFirstRows(SSDataBlock* pBlock, size_t n) { static void colDataKeepFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) { if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { + pColInfoData->varmeta.length = pColInfoData->varmeta.offset[n]; // pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, 0, n); memset(&pColInfoData->varmeta.offset[n], 0, total - n); } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 2534c5e9f0..cbf0d38bd9 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -648,7 +648,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo ASSERT(p->info.rows > 0 || p->info.type == STREAM_CHECKPOINT); taosArrayPush(pResList, &p); - if (current >= rowsThreshold) { + if (current >= rowsThreshold || current >= pRes->info.rows) { break; }