fix[query]:fix limit/offset bug.
This commit is contained in:
parent
c5dadcdb99
commit
20b36401ac
|
@ -84,6 +84,14 @@ int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t colDataGetFullLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) {
|
||||||
|
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||||
|
return pColumnInfoData->varmeta.length + sizeof(int32_t) * numOfRows;
|
||||||
|
} else {
|
||||||
|
return pColumnInfoData->info.bytes * numOfRows + BitmapLen(numOfRows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void colDataTrim(SColumnInfoData* pColumnInfoData) {
|
void colDataTrim(SColumnInfoData* pColumnInfoData) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -353,13 +361,7 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
total += colDataGetLength(pColInfoData, pBlock->info.rows);
|
total += colDataGetFullLength(pColInfoData, pBlock->info.rows);
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
|
||||||
total += sizeof(int32_t) * pBlock->info.rows;
|
|
||||||
} else {
|
|
||||||
total += BitmapLen(pBlock->info.rows);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
|
@ -656,10 +658,6 @@ double blockDataGetSerialRowSize(const SSDataBlock* pBlock) {
|
||||||
return rowSize;
|
return rowSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t getAllowedRowsForPage(const SSDataBlock* pBlock, size_t pgSize) {
|
|
||||||
return (int32_t) ((pgSize - blockDataGetSerialMetaSize(pBlock))/ blockDataGetSerialRowSize(pBlock));
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct SSDataBlockSortHelper {
|
typedef struct SSDataBlockSortHelper {
|
||||||
SArray* orderInfo; // SArray<SBlockOrderInfo>
|
SArray* orderInfo; // SArray<SBlockOrderInfo>
|
||||||
SSDataBlock* pDataBlock;
|
SSDataBlock* pDataBlock;
|
||||||
|
|
|
@ -94,8 +94,7 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput,
|
||||||
|
|
||||||
// NOTE: there are four bytes of an integer more than the required buffer space.
|
// NOTE: there are four bytes of an integer more than the required buffer space.
|
||||||
// struct size + data payload + length for each column + bitmap length
|
// struct size + data payload + length for each column + bitmap length
|
||||||
pBuf->allocSize = sizeof(SRetrieveTableRsp) + blockDataGetSerialMetaSize(pInput->pData) +
|
pBuf->allocSize = sizeof(SRetrieveTableRsp) + blockDataGetSerialMetaSize(pInput->pData) + blockDataGetSize(pInput->pData);
|
||||||
ceil(blockDataGetSerialRowSize(pInput->pData) * pInput->pData->info.rows);
|
|
||||||
|
|
||||||
pBuf->pData = taosMemoryMalloc(pBuf->allocSize);
|
pBuf->pData = taosMemoryMalloc(pBuf->allocSize);
|
||||||
if (pBuf->pData == NULL) {
|
if (pBuf->pData == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue