diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index fb8b2394f29e6d1a4764b05028489e0da0685876..fe0fc666d77a9cacf1f7e00e7bd3c86a121c6147 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -2488,7 +2488,7 @@ static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) { static bool top_bottom_function_setup(SQLFunctionCtx *pCtx) { if (!function_setup(pCtx)) { - return false; + //return false; } STopBotInfo *pInfo = getTopBotOutputInfo(pCtx); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 72ae0d566c6437127c5f6b5a255f5a25c3a57d7d..7d4f60d4efd9a59010722c7e56207f7e16a3ef4d 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -3786,7 +3786,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe pCtx->ptsOutputBuf = pRuntimeEnv->pCtx[0].pOutput; } - if (!pCtx->resultInfo->initialized) { + if (!pCtx->resultInfo->initialized || functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) { aAggs[functionId].init(pCtx); } }