fix(query): move the bitmap when drop first rows.

This commit is contained in:
Haojun Liao 2022-05-31 17:02:44 +08:00
parent 6007b8ad11
commit d358212a14
1 changed files with 24 additions and 10 deletions

View File

@ -1278,12 +1278,11 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
} else { } else {
int32_t tail = n % 8; int32_t tail = n % 8;
int32_t i = 0; int32_t i = 0;
uint8_t* p = (uint8_t*)nullBitmap; uint8_t* p = (uint8_t*)nullBitmap;
while (i < len) {
uint8_t v = p[i];
p[i] = 0; if (n < 8) {
while (i < len) {
uint8_t v = p[i]; // source bitmap value
p[i] = (v << tail); p[i] = (v << tail);
if (i < len - 1) { if (i < len - 1) {
@ -1293,8 +1292,23 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
i += 1; i += 1;
} }
} else if (n > 8) {
int32_t gap = len - newLen;
while(i < newLen) {
uint8_t v = p[i + gap];
p[i] = (v << tail);
if (i < newLen - 1) {
uint8_t next = p[i + gap + 1];
p[i] |= (next >> (8 - tail));
}
i += 1;
} }
} }
}
}
static void colDataTrimFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) { static void colDataTrimFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_t total) {
if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) {