提交 89895552 编写于 作者: G Ganlin Zhao

fix getBufPage return NULL in tpercentile.c

上级 929bafa2
......@@ -1587,7 +1587,7 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) {
// all data are null, set it completed
if (pInfo->numOfElems == 0) {
pResInfo->complete = true;
return 0;
return TSDB_CODE_SUCCESS;
} else {
pInfo->pMemBucket = tMemBucketCreate(pCol->info.bytes, type, pInfo->minval, pInfo->maxval);
}
......@@ -1650,7 +1650,10 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) {
char* data = colDataGetData(pCol, i);
numOfElems += 1;
tMemBucketPut(pInfo->pMemBucket, data, 1);
int32_t code = tMemBucketPut(pInfo->pMemBucket, data, 1);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
}
SET_VAL(pResInfo, numOfElems, 1);
......
......@@ -385,6 +385,9 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
}
pSlot->info.data = getNewBufPage(pBucket->pBuffer, &pageId);
if (pSlot->info.data == NULL) {
return TSDB_CODE_NO_AVAIL_DISK;
}
pSlot->info.pageId = pageId;
taosArrayPush(pPageIdList, &pageId);
}
......@@ -396,7 +399,7 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
}
pBucket->total += count;
return 0;
return TSDB_CODE_SUCCESS;
}
////////////////////////////////////////////////////////////////////////////////////////////
......@@ -517,7 +520,10 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
return -1;
}
tMemBucketPut(pMemBucket, pg->data, (int32_t)pg->num);
int32_t code = tMemBucketPut(pMemBucket, pg->data, (int32_t)pg->num);
if (code != TSDB_CODE_SUCCESS) {
return -1;
}
setBufPageDirty(pg, true);
releaseBufPage(pMemBucket->pBuffer, pg);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册