Skip to content

Commit

Permalink
fixed handling of exclude filters on table encoding in columnar accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
glookka committed Jul 27, 2024
1 parent e7fc892 commit 020c82e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions columnar/accessor/accessorint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ class AnalyzerBlock_Int_Table_c : public AnalyzerBlock_c
FORCE_INLINE bool SetupNextBlock ( const StoredBlock_Int_Table_T<T> & tBlock, bool bEq );

template <typename T>
FORCE_INLINE bool AllPassFilter ( const StoredBlock_Int_Table_T<T> & tBlock ) const;
FORCE_INLINE bool AllPassFilter ( const StoredBlock_Int_Table_T<T> & tBlock, bool bEq ) const;

private:
int m_iTableValueId = -1;
Expand Down Expand Up @@ -714,19 +714,19 @@ bool AnalyzerBlock_Int_Table_c::SetupNextBlock ( const StoredBlock_Int_Table_T<T
}

template <typename T>
bool AnalyzerBlock_Int_Table_c::AllPassFilter ( const StoredBlock_Int_Table_T<T> & tBlock ) const
bool AnalyzerBlock_Int_Table_c::AllPassFilter ( const StoredBlock_Int_Table_T<T> & tBlock, bool bEq ) const
{
switch ( m_eType )
{
case FilterType_e::VALUES:
if ( m_dValues.size()==1 )
{
if ( tBlock.GetTableSize()==1 && m_iTableValueId!=-1 )
if ( tBlock.GetTableSize()==1 && ( ( m_iTableValueId!=-1 ) ^ ( !bEq ) ) )
return true;
}
else
{
if ( m_dTableValues.size()==tBlock.GetTableSize() )
if ( m_dTableValues.size()==tBlock.GetTableSize() && bEq )
return true;
}
break;
Expand Down Expand Up @@ -1167,7 +1167,7 @@ bool Analyzer_INT_T<VALUES,ACCESSOR_VALUES,RANGE_EVAL,HAVE_MATCHING_BLOCKS>::Mov

case IntPacking_e::TABLE:
bProcessBlock = m_tBlockTable.SetupNextBlock<ACCESSOR_VALUES,RANGE_EVAL> ( ACCESSOR::m_tBlockTable, !m_tSettings.m_bExclude );
if ( bProcessBlock && m_tBlockTable.AllPassFilter ( ACCESSOR::m_tBlockTable ) )
if ( bProcessBlock && m_tBlockTable.AllPassFilter ( ACCESSOR::m_tBlockTable, !m_tSettings.m_bExclude ) )
ePackingForProcessingFunc = IntPacking_e::CONST;
break;

Expand Down Expand Up @@ -1243,6 +1243,9 @@ Analyzer_i * CreateAnalyzerInt ( const AttributeHeader_i & tHeader, uint32_t uVe
if ( tSettings.m_eType!=FilterType_e::VALUES && tSettings.m_eType!=FilterType_e::RANGE && tSettings.m_eType!=FilterType_e::FLOATRANGE )
return nullptr;

if ( ( tSettings.m_eType==FilterType_e::RANGE || tSettings.m_eType==FilterType_e::FLOATRANGE ) && tSettings.m_bExclude )
return nullptr;

int iIndex = bHaveMatchingBlocks*16 + tSettings.m_bLeftClosed*8 + tSettings.m_bRightClosed*4 + tSettings.m_bLeftUnbounded*2 + tSettings.m_bRightUnbounded;
switch ( iIndex )
{
Expand Down

0 comments on commit 020c82e

Please sign in to comment.