diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index c0983e29cc4052a47ae5a69019ebf457e2759a24..612677634f277d8a372c1a149a6964af1c9eb950 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -911,7 +911,6 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs, TSKEY* pEndTs, int32_t rows, int32_t start, int64_t gap, SHashObj* pStDeleted); bool functionNeedToExecute(SqlFunctionCtx* pCtx); -int32_t compareTimeWindow(const void* p1, const void* p2, const void* param); int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition, SqlFunctionCtx* pCtx, SExprInfo* pExprInfo, int32_t numOfExprs, const int32_t* rowCellOffset, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 842f220c6ef8e5ced62b91547c1202112edd9a2d..b209684388d83c4a128eca2fb6891277d8aa0e8a 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -4546,18 +4546,6 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo return pOptr; } -int32_t compareTimeWindow(const void* p1, const void* p2, const void* param) { - const SQueryTableDataCond* pCond = param; - const STimeWindow* pWin1 = p1; - const STimeWindow* pWin2 = p2; - if (pCond->order == TSDB_ORDER_ASC) { - return pWin1->skey - pWin2->skey; - } else if (pCond->order == TSDB_ORDER_DESC) { - return pWin2->skey - pWin1->skey; - } - return 0; -} - SArray* extractColumnInfo(SNodeList* pNodeList) { size_t numOfCols = LIST_LENGTH(pNodeList); SArray* pList = taosArrayInit(numOfCols, sizeof(SColumn)); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 2be8b4e5795f863bf1665036dc94f63412ee55f7..fb1169b3d32bf3482c0910d6d7dac57b3cd24cad 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1156,11 +1156,13 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator) { while (1) { doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->aggSup.pResultBuf); doFilter(pInfo->pCondition, pBlock); + bool hasRemain = hasDataInGroupInfo(&pInfo->groupResInfo); if (!hasRemain) { doSetOperatorCompleted(pOperator); break; } + if (pBlock->info.rows > 0) { break; } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index d8fcca30c0eb17bd6082dd0af2a2b88a65fef72d..f95ec78c76f0d67ccdd560846315b1350594705b 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1863,8 +1863,6 @@ static void stddevTransferInfo(SStddevRes* pInput, SStddevRes* pOutput) { } pOutput->count += pInput->count; - - return; } int32_t stddevFunctionMerge(SqlFunctionCtx* pCtx) { @@ -1874,14 +1872,13 @@ int32_t stddevFunctionMerge(SqlFunctionCtx* pCtx) { SStddevRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - SStddevRes* pInputInfo = (SStddevRes*)varDataVal(data); - - stddevTransferInfo(pInputInfo, pInfo); + for(int32_t i = pInput->startRowIndex; i < pInput->startRowIndex + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); + SStddevRes* pInputInfo = (SStddevRes*)varDataVal(data); + stddevTransferInfo(pInputInfo, pInfo); + } SET_VAL(GET_RES_INFO(pCtx), 1, 1); - return TSDB_CODE_SUCCESS; }