From 2bb6b57b2a3c695366494564760192ad9b9a5a84 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 9 Nov 2021 05:05:14 -0500 Subject: [PATCH] mixed 8562 pr --- src/client/src/tscUtil.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index b03aef9e18..0b9674f3be 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -942,23 +942,30 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) { pBlock->info.rows = pRes->numOfRows; if (pRes->numOfRows != 0) { doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo); - *newgroup = false; - return pBlock; + if (pBlock->info.rows > 0) { + *newgroup = false; + return pBlock; + } } - // No data block exists. So retrieve and transfer it into to SSDataBlock - TAOS_ROW pRow = NULL; - taos_fetch_block(pSql, &pRow); + SSDataBlock* result = NULL; + do { + // No data block exists. So retrieve and transfer it into to SSDataBlock + TAOS_ROW pRow = NULL; + taos_fetch_block(pSql, &pRow); - if (pRes->numOfRows == 0) { - pOperator->status = OP_EXEC_DONE; - return NULL; - } + if (pRes->numOfRows == 0) { + pOperator->status = OP_EXEC_DONE; + result = NULL; + break; + } + pBlock->info.rows = pRes->numOfRows; + doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo); + *newgroup = false; + result = pBlock; + } while (result->info.rows == 0); - pBlock->info.rows = pRes->numOfRows; - doSetupSDataBlock(pRes, pBlock, pInput->pFilterInfo); - *newgroup = false; - return pBlock; + return result; } static void fetchNextBlockIfCompleted(SOperatorInfo* pOperator, bool* newgroup) { -- GitLab