diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 1792a18c07b0d8acd144ee788612d5c81ebf6115..f7b0da0014ee3d0bf0938817e4ea752a73ed4296 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1107,6 +1107,11 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF void blockDataCleanup(SSDataBlock* pDataBlock) { pDataBlock->info.rows = 0; + pDataBlock->info.groupId = 0; + + pDataBlock->info.window.ekey = 0; + pDataBlock->info.window.skey = 0; + 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/executorimpl.c b/source/libs/executor/src/executorimpl.c index ee71c38ee4a2a095fd847061823e717fb84a0f80..a930a7bb46a0dcedc4b79544713bd7a220f39a25 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1336,12 +1336,10 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowRes, bool keep); void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) { - if (pFilterNode == NULL) { - return; - } - if (pBlock->info.rows == 0) { + if (pFilterNode == NULL || pBlock->info.rows == 0) { return; } + SFilterInfo* filter = NULL; // todo move to the initialization function @@ -1358,8 +1356,6 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) { filterFreeInfo(filter); extractQualifiedTupleByFilterResult(pBlock, rowRes, keep); - blockDataUpdateTsWindow(pBlock, 0); - taosMemoryFree(rowRes); } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 176da0bb48eac3ce009de3c754b3e78290814db3..05f84df7f8ddf8a743901024087e1a9a2e7e8076 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2592,6 +2592,7 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SAPercentileInfo* pInfo = (SAPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo); if (pInfo->algo == APERCT_ALGO_TDIGEST) { + buildTDigestInfo(pInfo); if (pInfo->pTDigest->size > 0) { pInfo->result = tdigestQuantile(pInfo->pTDigest, pInfo->percent / 100); } else { // no need to free @@ -2599,6 +2600,7 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return TSDB_CODE_SUCCESS; } } else { + buildHistogramInfo(pInfo); if (pInfo->pHisto->numOfElems > 0) { qDebug("get the final res:%d, elements:%"PRId64", entry:%d", pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries);