Skip to content

Commit

Permalink
clamp iterator esitmates for FilterType_e::VALUES; changed PGM epsilo…
Browse files Browse the repository at this point in the history
…n from 64 to 16
  • Loading branch information
glookka committed Jun 11, 2023
1 parent 7d3ae05 commit 4b21f46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
31 changes: 9 additions & 22 deletions secondary/pgm.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ namespace SI
};

template <typename VALUE>
struct PGM_T : public pgm::PGMIndex<VALUE>, public PGM_i
class PGM_T : public pgm::PGMIndex<VALUE,16>, public PGM_i
{
PGM_T ()
{
}
using BASE = pgm::PGMIndex<VALUE,16>;
using BASE::BASE;

public:
template<typename RandomIt>
PGM_T ( RandomIt tBegin, RandomIt tEnd )
: pgm::PGMIndex<VALUE> ( tBegin, tEnd )
{
}
: BASE ( tBegin, tEnd )
{}

size_t Save ( std::vector<uint8_t> & dData ) const final
{
Expand Down Expand Up @@ -104,21 +103,9 @@ namespace SI
}

ApproxPos_t Search ( uint64_t uVal ) const final;

void WriteTypedKey ( util::MemWriter_c & tWr, VALUE tVal ) const
{
tWr.Pack_uint64 ( (uint64_t)tVal );
}

void LoadTypedKey ( util::FileReader_c & tRd, VALUE & tVal ) const
{
tVal = tRd.Unpack_uint64();
}

bool IsEmpty () const final
{
return ( this->n==0 );
}
void WriteTypedKey ( util::MemWriter_c & tWr, VALUE tVal ) const { tWr.Pack_uint64 ( (uint64_t)tVal ); }
void LoadTypedKey ( util::FileReader_c & tRd, VALUE & tVal ) const { tVal = tRd.Unpack_uint64(); }
bool IsEmpty () const final { return this->n==0; }
};

template<>
Expand Down
5 changes: 4 additions & 1 deletion secondary/secondary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,10 @@ uint32_t SecondaryIndex_c::GetNumIterators ( const common::Filter_t & tFilter )
switch ( tFixedFilter.m_eType )
{
case FilterType_e::VALUES:
return GetValsRows ( nullptr, tFixedFilter, nullptr, 0, 0, INT_MAX );
{
uint32_t uNumIterators = GetValsRows ( nullptr, tFixedFilter, nullptr, 0, 0, INT_MAX );
return std::min ( (uint32_t)tFilter.m_dValues.size(), uNumIterators );
}

case FilterType_e::RANGE:
case FilterType_e::FLOATRANGE:
Expand Down

0 comments on commit 4b21f46

Please sign in to comment.