diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 404274ee5267ed4c0065442df82d3444a5b90d72..c6f9565bdab927cc9c7ef89dd196ebc3b7bc318a 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;