Merge pull request #18108 from taosdata/fix/TD-20366
fix: runtime error (division by zero in builtinsimpl.c)
This commit is contained in:
commit
72f6b93417
|
@ -5280,7 +5280,6 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
return pInfo->numSampled;
|
return pInfo->numSampled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool getTailFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) {
|
bool getTailFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) {
|
||||||
#if 0
|
#if 0
|
||||||
SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0);
|
SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0);
|
||||||
|
@ -6077,11 +6076,19 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
|
|
||||||
int32_t row = 0;
|
int32_t row = 0;
|
||||||
char st[256] = {0};
|
char st[256] = {0};
|
||||||
double totalRawSize = pData->totalRows * pData->rowSize;
|
double averageSize = 0;
|
||||||
|
if (pData->numOfBlocks != 0) {
|
||||||
|
averageSize = ((double)pData->totalSize) / pData->numOfBlocks;
|
||||||
|
}
|
||||||
|
uint64_t totalRawSize = pData->totalRows * pData->rowSize;
|
||||||
|
double compRatio = 0;
|
||||||
|
if (totalRawSize != 0) {
|
||||||
|
compRatio = pData->totalSize * 100 / (double)totalRawSize;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t len = sprintf(st + VARSTR_HEADER_SIZE,
|
int32_t len = sprintf(st + VARSTR_HEADER_SIZE,
|
||||||
"Total_Blocks=[%d] Total_Size=[%.2f Kb] Average_size=[%.2f Kb] Compression_Ratio=[%.2f %c]",
|
"Total_Blocks=[%d] Total_Size=[%.2f Kb] Average_size=[%.2f Kb] Compression_Ratio=[%.2f %c]",
|
||||||
pData->numOfBlocks, pData->totalSize / 1024.0, ((double)pData->totalSize) / pData->numOfBlocks,
|
pData->numOfBlocks, pData->totalSize / 1024.0, averageSize, compRatio, '%');
|
||||||
pData->totalSize * 100 / totalRawSize, '%');
|
|
||||||
|
|
||||||
varDataSetLen(st, len);
|
varDataSetLen(st, len);
|
||||||
colDataAppend(pColInfo, row++, st, false);
|
colDataAppend(pColInfo, row++, st, false);
|
||||||
|
|
|
@ -321,7 +321,7 @@
|
||||||
,,y,script,./test.sh -f tsim/compress/compress.sim
|
,,y,script,./test.sh -f tsim/compress/compress.sim
|
||||||
,,y,script,./test.sh -f tsim/compress/uncompress.sim
|
,,y,script,./test.sh -f tsim/compress/uncompress.sim
|
||||||
,,y,script,./test.sh -f tsim/compute/avg.sim
|
,,y,script,./test.sh -f tsim/compute/avg.sim
|
||||||
,,,script,./test.sh -f tsim/compute/block_dist.sim
|
,,y,script,./test.sh -f tsim/compute/block_dist.sim
|
||||||
,,y,script,./test.sh -f tsim/compute/bottom.sim
|
,,y,script,./test.sh -f tsim/compute/bottom.sim
|
||||||
,,y,script,./test.sh -f tsim/compute/count.sim
|
,,y,script,./test.sh -f tsim/compute/count.sim
|
||||||
,,y,script,./test.sh -f tsim/compute/diff.sim
|
,,y,script,./test.sh -f tsim/compute/diff.sim
|
||||||
|
|
Loading…
Reference in New Issue