diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index ac4811fb1b..8e8c9d9a85 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1362,6 +1362,8 @@ void blockDataEmpty(SSDataBlock* pDataBlock) { return; } + taosMemoryFreeClear(pDataBlock->pBlockAgg); + size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i); diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index eb549db6d2..9ca681779d 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2178,7 +2178,7 @@ int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* return code; } if (group == NULL || groupByTbname) { - if (groupByTbname && tsCountAlwaysReturnValue && ((STableScanPhysiNode*)pScanNode)->needCountEmptyTable) { + if (tsCountAlwaysReturnValue && QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == nodeType(pScanNode) && ((STableScanPhysiNode*)pScanNode)->needCountEmptyTable) { pTableListInfo->remainGroups = taosHashInit(numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); if (pTableListInfo->remainGroups == NULL) {