From 884b35928a907a070cddd3f01b1dfccf94aa55bd Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Tue, 12 Jul 2022 10:55:51 +0800 Subject: [PATCH] enh(query): apercentile function adoption for MIA operator TD-17254 --- source/libs/function/src/builtinsimpl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 404274ee52..c6f9565bda 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2514,11 +2514,13 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - SAPercentileInfo* pInputInfo = (SAPercentileInfo*)varDataVal(data); + int32_t start = pInput->startRowIndex; - apercentileTransferInfo(pInputInfo, pInfo); + for(int32_t i = start; i < start + pInput->numOfRows; ++i) { + char* data = colDataGetData(pCol, i); + SAPercentileInfo* pInputInfo = (SAPercentileInfo*)varDataVal(data); + apercentileTransferInfo(pInputInfo, pInfo); + } SET_VAL(pResInfo, 1, 1); return TSDB_CODE_SUCCESS; -- GitLab