refactor code

This commit is contained in:
yihaoDeng 2024-11-27 11:15:05 +08:00
parent 43e079c948
commit bfb651b8c6
1 changed files with 8 additions and 6 deletions

View File

@ -1803,7 +1803,8 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) {
pResInfo->complete = true;
return TSDB_CODE_SUCCESS;
} else {
code = tMemBucketCreate(pCol->info.bytes, type, pInfo->minval, pInfo->maxval, pCtx->hasWindowOrGroup, &pInfo->pMemBucket, pInfo->numOfElems);
code = tMemBucketCreate(pCol->info.bytes, type, pInfo->minval, pInfo->maxval, pCtx->hasWindowOrGroup,
&pInfo->pMemBucket, pInfo->numOfElems);
if (TSDB_CODE_SUCCESS != code) {
return code;
}
@ -3088,7 +3089,6 @@ int32_t lastRowFunction(SqlFunctionCtx* pCtx) {
pResInfo->numOfRes = 1;
}
}
}
SET_VAL(pResInfo, numOfElems, 1);
@ -6552,6 +6552,7 @@ int32_t blockDBUsageFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
if (NULL == pColInfo) {
return TSDB_CODE_OUT_OF_RANGE;
}
int32_t len = 0;
int32_t row = 0;
char st[256] = {0};
@ -6560,10 +6561,11 @@ int32_t blockDBUsageFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
double compressRadio = 0;
if (rawDataSize != 0) {
compressRadio = totalDiskSize * 100 / (double)rawDataSize;
len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio: %.2f", compressRadio);
} else {
len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio: NULL");
}
int32_t len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Compress_radio: %.2f", compressRadio);
varDataSetLen(st, len);
int32_t code = colDataSetVal(pColInfo, row++, st, false);
if (TSDB_CODE_SUCCESS != code) {