From 06a09870db326ffa31e5581a0076c1b914021600 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 25 Oct 2026 22:19:00 +0100 Subject: [PATCH 1/2] fix: secondary index stored a value set twice for one row twice A value given more than once for the same row, such as 2 in the JSON array [2,2] or "Y" and "y" in a string array (one case-insensitive hash), was stored twice in the row list of that value. A filter on the value then returned the row twice, and the count of the value counted it twice. The row writer gets the values sorted by value and row, so the repeat comes right after the first one; it is now skipped. --- secondary/builder.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/secondary/builder.cpp b/secondary/builder.cpp index e24e79be..9213ec22 100644 --- a/secondary/builder.cpp +++ b/secondary/builder.cpp @@ -391,10 +391,12 @@ void RowWriter_T::NextValue ( const RawValue_T & tBin, { // collect row-list // or flush and store new value - if ( IS_FLOAT_VALUE && ( FloatEqual ( UintToFloat ( m_tLastValue ), UintToFloat ( tBin.m_tValue ) ) ) ) - m_dRows.push_back ( tBin.m_tRowid ); - else if ( !IS_FLOAT_VALUE && m_tLastValue==tBin.m_tValue ) - m_dRows.push_back ( tBin.m_tRowid ); + if ( IS_FLOAT_VALUE ? FloatEqual ( UintToFloat ( m_tLastValue ), UintToFloat ( tBin.m_tValue ) ) : m_tLastValue==tBin.m_tValue ) + { + // values come sorted by value and row: a value set twice for one row (e.g. [2,2] in json) is stored once + if ( m_dRows.back()!=tBin.m_tRowid ) + m_dRows.push_back ( tBin.m_tRowid ); + } else { FlushValue(m_tDstFile); From 6bd8a8f817da75242f8f7d26d4074a9234a55bc9 Mon Sep 17 00:00:00 2001 From: Stas Date: Sun, 25 Oct 2026 22:19:24 +0100 Subject: [PATCH 2/2] fix: ALL() with one value matched an empty MVA ALL(tags) = 2 on a columnar MVA matched a row with an empty MVA (and ANY(tags) != 2 dropped it), while ALL() with several values and with a range, and ALL() on a row-wise MVA, do not match an empty MVA. The single-value check now rejects an empty MVA too. --- columnar/accessor/accessormva.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/columnar/accessor/accessormva.cpp b/columnar/accessor/accessormva.cpp index 3428a9f8..56e64598 100644 --- a/columnar/accessor/accessormva.cpp +++ b/columnar/accessor/accessormva.cpp @@ -48,6 +48,9 @@ class MvaAll_T template static FORCE_INLINE bool Test ( const Span_T & dValues, int64_t iTestValue ) { + if ( dValues.empty() ) + return false ^ (!EQ); + for ( auto i : dValues ) if ( i!=iTestValue ) return false ^ (!EQ);