more code
This commit is contained in:
parent
5ed903dd01
commit
f05fe86ef0
|
@ -110,8 +110,8 @@ int32_t tValueColumnClear(SValueColumn *valCol);
|
|||
int32_t tValueColumnAppend(SValueColumn *valCol, const SValue *value);
|
||||
int32_t tValueColumnGet(SValueColumn *valCol, int32_t idx, SValue *value);
|
||||
int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *info, SBuffer *output, SBuffer *assist);
|
||||
int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColumnCompressInfo *compressInfo,
|
||||
SValueColumn *valCol, SBuffer *buffer);
|
||||
int32_t tValueColumnDecompress(void *input, const SValueColumnCompressInfo *compressInfo, SValueColumn *valCol,
|
||||
SBuffer *buffer);
|
||||
int32_t tValueColumnCompressInfoEncode(const SValueColumnCompressInfo *compressInfo, SBuffer *buffer);
|
||||
int32_t tValueColumnCompressInfoDecode(SBufferReader *reader, SValueColumnCompressInfo *compressInfo);
|
||||
int32_t tValueCompare(const SValue *tv1, const SValue *tv2);
|
||||
|
|
|
@ -4072,21 +4072,11 @@ int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *inf
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColumnCompressInfo *info,
|
||||
SValueColumn *valCol, SBuffer *buffer) {
|
||||
int32_t tValueColumnDecompress(void *input, const SValueColumnCompressInfo *info, SValueColumn *valCol,
|
||||
SBuffer *assist) {
|
||||
int32_t code;
|
||||
SBuffer local;
|
||||
char *inputStart = input;
|
||||
|
||||
ASSERT(inputSize == info->offsetCompressedSize + info->dataCompressedSize);
|
||||
|
||||
tValueColumnClear(valCol);
|
||||
tBufferInit(&local);
|
||||
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
}
|
||||
|
||||
valCol->type = info->type;
|
||||
// offset
|
||||
if (IS_VAR_DATA_TYPE(valCol->type)) {
|
||||
|
@ -4099,19 +4089,10 @@ int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColum
|
|||
.compressedSize = info->offsetCompressedSize,
|
||||
};
|
||||
|
||||
code = tBufferEnsureCapacity(&valCol->offsets, cinfo.originalSize);
|
||||
code = tDecompressDataToBuffer(input, &cinfo, &valCol->offsets, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = tDecompressData(inputStart, &cinfo, valCol->offsets.data, cinfo.originalSize, buffer);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
valCol->offsets.size = cinfo.originalSize;
|
||||
inputStart += cinfo.compressedSize;
|
||||
} else {
|
||||
valCol->numOfValues = info->dataOriginalSize / tDataTypes[valCol->type].bytes;
|
||||
}
|
||||
|
@ -4124,21 +4105,11 @@ int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColum
|
|||
.compressedSize = info->dataCompressedSize,
|
||||
};
|
||||
|
||||
code = tBufferEnsureCapacity(&valCol->data, cinfo.originalSize);
|
||||
code = tDecompressDataToBuffer((char *)input + info->offsetCompressedSize, &cinfo, &valCol->data, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
|
||||
code = tDecompressData(inputStart, &cinfo, valCol->data.data, cinfo.originalSize, buffer);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
valCol->data.size = cinfo.originalSize;
|
||||
inputStart += cinfo.compressedSize;
|
||||
|
||||
tBufferDestroy(&local);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,8 +244,8 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
|||
SValueColumnCompressInfo *info = firstInfos + i;
|
||||
int32_t totalCompressedSize = info->offsetCompressedSize + info->dataCompressedSize;
|
||||
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(br.buffer, br.offset), totalCompressedSize, info,
|
||||
brinBlock->firstKeyPKs + i, reader->buffers + 1);
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(br.buffer, br.offset), info, brinBlock->firstKeyPKs + i,
|
||||
reader->buffers + 1);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
br.offset += totalCompressedSize;
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
|||
SValueColumnCompressInfo *info = lastInfos + i;
|
||||
int32_t totalCompressedSize = info->offsetCompressedSize + info->dataCompressedSize;
|
||||
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(br.buffer, br.offset), totalCompressedSize, info,
|
||||
brinBlock->lastKeyPKs + i, reader->buffers + 1);
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(br.buffer, br.offset), info, brinBlock->lastKeyPKs + i,
|
||||
reader->buffers + 1);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
br.offset += totalCompressedSize;
|
||||
}
|
||||
|
|
|
@ -373,15 +373,15 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta
|
|||
|
||||
// decode value columns
|
||||
for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), firstKeyInfos[i].dataCompressedSize,
|
||||
&firstKeyInfos[i], &statisBlock->firstKeyPKs[i], &reader->buffers[1]);
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), &firstKeyInfos[i],
|
||||
&statisBlock->firstKeyPKs[i], &reader->buffers[1]);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
size += firstKeyInfos[i].dataCompressedSize;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), lastKeyInfos[i].dataCompressedSize,
|
||||
&lastKeyInfos[i], &statisBlock->lastKeyPKs[i], &reader->buffers[1]);
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), &lastKeyInfos[i],
|
||||
&statisBlock->lastKeyPKs[i], &reader->buffers[1]);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
size += lastKeyInfos[i].dataCompressedSize;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue