提交 3b947f17 编写于 作者: H Hongze Cheng

more code

上级 dcbdc43f
...@@ -1744,47 +1744,16 @@ int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol ...@@ -1744,47 +1744,16 @@ int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol
int32_t size = 0; int32_t size = 0;
// bitmap // bitmap
if (pColData->flag != HAS_VALUE) { if (pColData->flag != HAS_VALUE) {
uint8_t *pBitMap = pColData->pBitMap; int32_t szBitMap;
int32_t szBitMap = BIT2_SIZE(pColData->nVal); if (pColData->flag == (HAS_VALUE | HAS_NULL | HAS_NONE)) {
szBitMap = BIT2_SIZE(pColData->nVal);
// BIT2 to BIT1 } else {
if (pColData->flag != (HAS_VALUE | HAS_NULL | HAS_NONE)) {
szBitMap = BIT1_SIZE(pColData->nVal); szBitMap = BIT1_SIZE(pColData->nVal);
pBitMap = taosMemoryCalloc(1, szBitMap);
if (pBitMap == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _exit;
}
for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) {
uint8_t v = GET_BIT2(pColData->pBitMap, iVal);
switch (pColData->flag) {
case (HAS_NULL | HAS_NONE):
SET_BIT1(pBitMap, iVal, v);
break;
case (HAS_VALUE | HAS_NONE):
if (v) {
SET_BIT1(pBitMap, iVal, 1);
} else {
SET_BIT1(pBitMap, iVal, 0);
}
break;
case (HAS_VALUE | HAS_NULL):
SET_BIT1(pBitMap, iVal, v - 1);
break;
default:
ASSERT(0);
}
}
} }
code = tsdbCmprData(pBitMap, szBitMap, TSDB_DATA_TYPE_TINYINT, cmprAlg, ppOut, nOut + size, &pBlockCol->szBitmap, code = tsdbCmprData(pColData->pBitMap, szBitMap, TSDB_DATA_TYPE_TINYINT, cmprAlg, ppOut, nOut + size,
ppBuf); &pBlockCol->szBitmap, ppBuf);
if (code) goto _exit; if (code) goto _exit;
if (pColData->flag != (HAS_VALUE | HAS_NULL | HAS_NONE)) {
taosMemoryFree(pBitMap);
}
} }
size += pBlockCol->szBitmap; size += pBlockCol->szBitmap;
...@@ -1822,46 +1791,15 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in ...@@ -1822,46 +1791,15 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in
uint8_t *p = pIn; uint8_t *p = pIn;
// bitmap // bitmap
if (pBlockCol->szBitmap) { if (pBlockCol->szBitmap) {
if (pBlockCol->flag != (HAS_VALUE | HAS_NULL | HAS_NONE)) { int32_t szBitMap;
uint8_t *pBitMap = NULL; if (pColData->flag == (HAS_VALUE | HAS_NULL | HAS_NONE)) {
code = tsdbDecmprData(p, pBlockCol->szBitmap, TSDB_DATA_TYPE_TINYINT, cmprAlg, &pBitMap, szBitMap = BIT2_SIZE(pColData->nVal);
BIT1_SIZE(pColData->nVal), ppBuf);
if (code) goto _exit;
code = tRealloc(&pColData->pBitMap, BIT2_SIZE(pColData->nVal));
if (code) {
tFree(pBitMap);
goto _exit;
}
// BIT1 to BIT2
for (int32_t iVal = 0; iVal < nVal; iVal++) {
uint8_t v = GET_BIT1(pBitMap, iVal);
switch (pBlockCol->flag) {
case (HAS_NULL | HAS_NONE):
SET_BIT2(pColData->pBitMap, iVal, v);
break;
case (HAS_VALUE | HAS_NONE):
if (v) {
SET_BIT2(pColData->pBitMap, iVal, 2);
} else {
SET_BIT2(pColData->pBitMap, iVal, 0);
}
break;
case (HAS_VALUE | HAS_NULL):
SET_BIT2(pColData->pBitMap, iVal, v + 1);
break;
default:
ASSERT(0);
}
}
tFree(pBitMap);
} else { } else {
code = tsdbDecmprData(p, pBlockCol->szBitmap, TSDB_DATA_TYPE_TINYINT, cmprAlg, &pColData->pBitMap, szBitMap = BIT1_SIZE(pColData->nVal);
BIT2_SIZE(pColData->nVal), ppBuf);
if (code) goto _exit;
} }
code = tsdbDecmprData(p, pBlockCol->szBitmap, TSDB_DATA_TYPE_TINYINT, cmprAlg, &pColData->pBitMap, szBitMap, ppBuf);
if (code) goto _exit;
} }
p += pBlockCol->szBitmap; p += pBlockCol->szBitmap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册