Merge pull request #20127 from taosdata/fix/TD-22733

fix: percentile finalize wrong error code issue
This commit is contained in:
dapan1121 2023-02-23 19:09:42 +08:00 committed by GitHub
commit f9188351d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 37 deletions

View File

@ -1689,11 +1689,7 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
double v = 0; double v = 0;
tMemBucket* pMemBucket = ppInfo->pMemBucket; tMemBucket* pMemBucket = ppInfo->pMemBucket;
if (pMemBucket == NULL || pMemBucket->total == 0) { // check for null if (pMemBucket != NULL && pMemBucket->total > 0) { // check for null
code = TSDB_CODE_FAILED;
goto _fin_error;
}
if (pCtx->numOfParams > 2) { if (pCtx->numOfParams > 2) {
char buf[512] = {0}; char buf[512] = {0};
size_t len = 1; size_t len = 1;
@ -1737,6 +1733,7 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
tMemBucketDestroy(pMemBucket); tMemBucketDestroy(pMemBucket);
return functionFinalize(pCtx, pBlock); return functionFinalize(pCtx, pBlock);
} }
}
_fin_error: _fin_error: