From 3c0b089cd1b09a3206d41131b0950a16d0abeac4 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Fri, 26 May 2023 18:23:37 +0200 Subject: [PATCH] fixed bitmap iterator description on empty result sets --- secondary/blockreader.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/secondary/blockreader.cpp b/secondary/blockreader.cpp index 75e746ac..5e43e873 100644 --- a/secondary/blockreader.cpp +++ b/secondary/blockreader.cpp @@ -177,12 +177,12 @@ template class BitmapIterator_T : public BitmapIterator_i { public: - BitmapIterator_T ( uint32_t uNumValues, const RowidRange_t * pBounds=nullptr ); + BitmapIterator_T ( const std::string & sAttr, uint32_t uNumValues, const RowidRange_t * pBounds=nullptr ); bool HintRowID ( uint32_t tRowID ) override; bool GetNextRowIdBlock ( Span_T & dRowIdBlock ) override; int64_t GetNumProcessed() const override { return m_iNumProcessed; } - void AddDesc ( std::vector & dDesc ) const override; + void AddDesc ( std::vector & dDesc ) const override { dDesc.push_back ( { m_sAttr, "SecondaryIndex" } ); } void SetCutoff ( int iCutoff ) override { m_iRowsLeft = iCutoff; } bool WasCutoffHit() const override { return !m_iRowsLeft; } @@ -192,7 +192,7 @@ class BitmapIterator_T : public BitmapIterator_i private: static const int RESULT_BLOCK_SIZE = 1024; BITMAP m_tBitmap; - std::vector m_dDesc; + std::string m_sAttr; int64_t m_iNumProcessed = 0; int m_iIndex = 0; int m_iRowsLeft = INT_MAX; @@ -201,8 +201,9 @@ class BitmapIterator_T : public BitmapIterator_i }; template -BitmapIterator_T::BitmapIterator_T ( uint32_t uNumValues, const RowidRange_t * pBounds ) - : m_tBitmap(uNumValues) +BitmapIterator_T::BitmapIterator_T ( const std::string & sAttr, uint32_t uNumValues, const RowidRange_t * pBounds ) + : m_tBitmap ( uNumValues ) + , m_sAttr ( sAttr ) { if ( pBounds ) m_tBounds = *pBounds; @@ -210,21 +211,11 @@ BitmapIterator_T::BitmapIterator_T ( uint32_t uNumValues, co m_dRows.resize(RESULT_BLOCK_SIZE); } -template -void BitmapIterator_T::AddDesc ( std::vector & dDesc ) const -{ - for ( const auto & i : m_dDesc ) - dDesc.push_back(i); -} - template void BitmapIterator_T::Add ( BlockIterator_i * pIterator ) { assert(pIterator); - if ( m_dDesc.empty() ) - pIterator->AddDesc(m_dDesc); - Span_T dRowIdBlock; while ( pIterator->GetNextRowIdBlock(dRowIdBlock) && m_iRowsLeft>0 ) { @@ -405,15 +396,15 @@ BitmapIterator_i * ReaderTraits_c::SpawnBitmapIterator ( const RowidRange_t * pB if ( m_tRsetInfo.m_uRowsCount>SMALL_INDEX_THRESH && float(m_tRsetInfo.m_iRsetSize)/m_tRsetInfo.m_uRowsCount<=LARGE_BITMAP_RATIO ) { if ( pBounds ) - return new BitmapIterator_T ( m_tRsetInfo.m_uRowsCount, pBounds ); + return new BitmapIterator_T ( m_sAttr, m_tRsetInfo.m_uRowsCount, pBounds ); else - return new BitmapIterator_T ( m_tRsetInfo.m_uRowsCount ); + return new BitmapIterator_T ( m_sAttr, m_tRsetInfo.m_uRowsCount ); } if ( pBounds ) - return new BitmapIterator_T, true> ( m_tRsetInfo.m_uRowsCount, pBounds ); + return new BitmapIterator_T, true> ( m_sAttr, m_tRsetInfo.m_uRowsCount, pBounds ); else - return new BitmapIterator_T, false> ( m_tRsetInfo.m_uRowsCount ); + return new BitmapIterator_T, false> ( m_sAttr, m_tRsetInfo.m_uRowsCount ); }