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); 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);