diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index af42ca60400d8fe17fbf90de4c0a75f73b5cb8a1..0dd8cb9b0c12a1e120dc4109bad6c593ac73e866 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1590,7 +1590,7 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) { i += 1; } } else if (n > 8) { - int32_t remain = (total % 8 <= tail) ? 1 : 0; + int32_t remain = (total % 8 != 0 && total % 8 <= tail) ? 1 : 0; int32_t gap = len - newLen - remain; while (i < newLen) { uint8_t v = p[i + gap]; diff --git a/tests/system-test/2-query/limit.py b/tests/system-test/2-query/limit.py index f51ed06008953604615371c9c00e1917f0a3ad54..c00e3b7d56af46f662ddb855a34e154e7c723b80 100644 --- a/tests/system-test/2-query/limit.py +++ b/tests/system-test/2-query/limit.py @@ -288,7 +288,7 @@ class TDTestCase: tdSql.checkData(0, 3, 5.000000000) tdSql.checkData(0, 4, 5.000000000) tdSql.checkData(0, 5, 0.000000000) - tdSql.checkData(0, 7, None) + tdSql.checkData(0, 7, 1) tdSql.checkData(0, 8, "binary5") tdSql.checkData(0, 9, "nchar5") tdSql.checkData(1, 8, None)