fix(query): set correct memory buffer size.
This commit is contained in:
parent
ed8002f903
commit
02a53ee81f
|
@ -1169,7 +1169,9 @@ int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pDataBlock->info.capacity < numOfRows) {
|
||||||
pDataBlock->info.capacity = numOfRows;
|
pDataBlock->info.capacity = numOfRows;
|
||||||
|
}
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
|
@ -1878,15 +1880,21 @@ const char* blockCompressDecode(SSDataBlock* pBlock, int32_t numOfCols, int32_t
|
||||||
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||||
pColInfoData->varmeta.length = colLen[i];
|
// pColInfoData->varmeta.length = colLen[i];
|
||||||
pColInfoData->varmeta.allocLen = colLen[i];
|
// pColInfoData->varmeta.allocLen = colLen[i];
|
||||||
|
|
||||||
memcpy(pColInfoData->varmeta.offset, pStart, sizeof(int32_t) * numOfRows);
|
memcpy(pColInfoData->varmeta.offset, pStart, sizeof(int32_t) * numOfRows);
|
||||||
pStart += sizeof(int32_t) * numOfRows;
|
pStart += sizeof(int32_t) * numOfRows;
|
||||||
|
|
||||||
if (colLen[i] > 0 && pColInfoData->pData == NULL) {
|
if (colLen[i] > 0 && pColInfoData->varmeta.allocLen < colLen[i]) {
|
||||||
taosMemoryFreeClear(pColInfoData->pData);
|
char* tmp = taosMemoryRealloc(pColInfoData->pData, colLen[i]);
|
||||||
pColInfoData->pData = taosMemoryMalloc(colLen[i]);
|
if (tmp == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pColInfoData->pData = tmp;
|
||||||
|
pColInfoData->varmeta.allocLen = colLen[i];
|
||||||
|
pColInfoData->varmeta.length = colLen[i];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy(pColInfoData->nullbitmap, pStart, BitmapLen(numOfRows));
|
memcpy(pColInfoData->nullbitmap, pStart, BitmapLen(numOfRows));
|
||||||
|
|
Loading…
Reference in New Issue