fix: colDataAssign
This commit is contained in:
parent
3341d02060
commit
5647d990b4
|
@ -452,20 +452,31 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
|
|||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||
int32_t newLen = pSource->varmeta.offset[numOfRows - 1];
|
||||
if (newLen != -1) {
|
||||
if (pSource->info.type == TSDB_DATA_TYPE_JSON) {
|
||||
newLen += getJsonValueLen(pSource->pData + newLen);
|
||||
} else {
|
||||
newLen += varDataTLen(pSource->pData + newLen);
|
||||
}
|
||||
} else {
|
||||
newLen = pSource->varmeta.length;
|
||||
}
|
||||
|
||||
memcpy(pColumnInfoData->varmeta.offset, pSource->varmeta.offset, sizeof(int32_t) * numOfRows);
|
||||
if (pColumnInfoData->varmeta.allocLen < pSource->varmeta.length) {
|
||||
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, pSource->varmeta.length);
|
||||
if (pColumnInfoData->varmeta.allocLen < newLen) {
|
||||
char* tmp = taosMemoryRealloc(pColumnInfoData->pData, newLen);
|
||||
if (tmp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
pColumnInfoData->pData = tmp;
|
||||
pColumnInfoData->varmeta.allocLen = pSource->varmeta.length;
|
||||
pColumnInfoData->varmeta.allocLen = newLen;
|
||||
}
|
||||
|
||||
pColumnInfoData->varmeta.length = pSource->varmeta.length;
|
||||
pColumnInfoData->varmeta.length = newLen;
|
||||
if (pColumnInfoData->pData != NULL && pSource->pData != NULL) {
|
||||
memcpy(pColumnInfoData->pData, pSource->pData, pSource->varmeta.length);
|
||||
memcpy(pColumnInfoData->pData, pSource->pData, newLen);
|
||||
}
|
||||
} else {
|
||||
memcpy(pColumnInfoData->nullbitmap, pSource->nullbitmap, BitmapLen(numOfRows));
|
||||
|
@ -1688,7 +1699,7 @@ int32_t blockDataTrimFirstRows(SSDataBlock* pBlock, size_t n) {
|
|||
|
||||
static void colDataKeepFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) {
|
||||
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {
|
||||
pColInfoData->varmeta.length = pColInfoData->varmeta.offset[n];
|
||||
// pColInfoData->varmeta.length = pColInfoData->varmeta.offset[n];
|
||||
// pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, 0, n);
|
||||
memset(&pColInfoData->varmeta.offset[n], 0, total - n);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue