From e55ddddef3343bbc1500a73205a607b24bbfbd9c Mon Sep 17 00:00:00 2001 From: Stas Date: Wed, 28 Oct 2026 10:57:39 +0100 Subject: [PATCH] fix: filters through the columnar scan lost or repeated the last rows of a chunk FillWithIncreasingValues writes row ids four at a time with SSE but did not advance tRowID in that loop, so the last n%4 row ids started over from the first row id of the call. A full subblock (1024 rows) is a multiple of 4, so only the last subblock of a chunk was hit, on blocks where every row passes (const blocks, table blocks where all values pass). Intersected with another iterator, such a filter lost up to 1020 rows at the end of the chunk; on its own it returned up to 3 rows twice and dropped the last ones. Fixes manticoresoftware/manticoresearch#5047 --- util/util_private.h | 1 + 1 file changed, 1 insertion(+) diff --git a/util/util_private.h b/util/util_private.h index 4347dc77..d5dd04cc 100644 --- a/util/util_private.h +++ b/util/util_private.h @@ -558,6 +558,7 @@ inline int FillWithIncreasingValues ( uint32_t *& pRowID, size_t uNumValues, uin tAdd = _mm_add_epi32(tAdd, _mm_set1_epi32(4)); pRowID += 4; } + tRowID += (uint32_t)uValuesInBlocks; size_t uValuesLeft = uNumValues - uValuesInBlocks; pRowIDMax = pRowID + uValuesLeft;