fix(query): fix error in displaying block distribution.

This commit is contained in:
Haojun Liao 2023-02-28 14:20:14 +08:00
parent 60188e82a6
commit 4172041ec8
2 changed files with 2 additions and 2 deletions

View File

@ -4680,7 +4680,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
} }
static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t numOfRows) { static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t numOfRows) {
return (numOfRows - startRow) / bucketRange; return ((numOfRows - startRow) / bucketRange) - 1;
} }
int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTableBlockInfo) { int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTableBlockInfo) {

View File

@ -5582,7 +5582,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t bucketRange = (pData->defMaxRows - pData->defMinRows) / numOfBuckets; int32_t bucketRange = (pData->defMaxRows - pData->defMinRows) / numOfBuckets;
for (int32_t i = 0; i < tListLen(pData->blockRowsHisto); ++i) { for (int32_t i = 0; i < tListLen(pData->blockRowsHisto); ++i) {
len = sprintf(st + VARSTR_HEADER_SIZE, "%04d |", pData->defMinRows + bucketRange * i); len = sprintf(st + VARSTR_HEADER_SIZE, "%04d |", pData->defMinRows + bucketRange * (i + 1));
int32_t num = 0; int32_t num = 0;
if (pData->blockRowsHisto[i] > 0) { if (pData->blockRowsHisto[i] > 0) {