refactor code
This commit is contained in:
parent
2b424e366b
commit
b48a05c081
|
@ -238,13 +238,26 @@ int32_t l2ComressInitImpl_xz(char *lossyColumns, float fPrecision, double dPreci
|
||||||
uint32_t intervals, int32_t ifAdtFse, const char *compressor) {
|
uint32_t intervals, int32_t ifAdtFse, const char *compressor) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int32_t l2CompressImpl_xz(const char *const input, const int32_t nelements, char *const output, int32_t outputSize,
|
int32_t l2CompressImpl_xz(const char *const input, const int32_t inputSize, char *const output, int32_t outputSize,
|
||||||
const char type, int8_t lvl) {
|
const char type, int8_t lvl) {
|
||||||
return 0;
|
size_t len = FL2_compress(output + 1, outputSize - 1, input, inputSize, 0);
|
||||||
|
if (len > inputSize) {
|
||||||
|
output[0] = 0;
|
||||||
|
memcpy(output + 1, input, inputSize);
|
||||||
|
return inputSize + 1;
|
||||||
}
|
}
|
||||||
int32_t l2DecompressImpl_xz(const char *const input, const int32_t nelements, char *const output, int32_t outputSize,
|
output[0] = 1;
|
||||||
const char type) {
|
return len + 1;
|
||||||
return 0;
|
}
|
||||||
|
int32_t l2DecompressImpl_xz(const char *const input, const int32_t compressedSize, char *const output,
|
||||||
|
int32_t outputSize, const char type) {
|
||||||
|
if (input[0] == 1) {
|
||||||
|
return FL2_decompress(output, outputSize, input + 1, compressedSize - 1);
|
||||||
|
} else if (input[0] == 0) {
|
||||||
|
memcpy(output, input + 1, compressedSize - 1);
|
||||||
|
return compressedSize - 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TCompressL1FnSet compressL1Dict[] = {{"distabled", NULL, NULL, NULL},
|
TCompressL1FnSet compressL1Dict[] = {{"distabled", NULL, NULL, NULL},
|
||||||
|
|
|
@ -318,6 +318,12 @@ TEST(utilTest, compressAlg) {
|
||||||
setColEncode(&cmprAlg, 0);
|
setColEncode(&cmprAlg, 0);
|
||||||
compressImplTestByAlg(p, type, num, cmprAlg);
|
compressImplTestByAlg(p, type, num, cmprAlg);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
uint32_t cmprAlg = 0;
|
||||||
|
setColCompress(&cmprAlg, 5);
|
||||||
|
setColEncode(&cmprAlg, 0);
|
||||||
|
compressImplTestByAlg(p, type, num, cmprAlg);
|
||||||
|
}
|
||||||
taosMemoryFree(p);
|
taosMemoryFree(p);
|
||||||
printf("-------------");
|
printf("-------------");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue