Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Lloyd-Pottiger <[email protected]>
  • Loading branch information
Lloyd-Pottiger committed Aug 7, 2024
1 parent b17a62a commit 9fab7b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 4 additions & 0 deletions dbms/src/Storages/DeltaMerge/BitmapFilter/BitmapFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
namespace DB::DM
{

class BitmapFilterView;

class BitmapFilter
{
public:
Expand Down Expand Up @@ -50,6 +52,8 @@ class BitmapFilter

std::vector<bool> filter;
bool all_match;

friend class BitmapFilterView;
};

using BitmapFilterPtr = std::shared_ptr<BitmapFilter>;
Expand Down
12 changes: 4 additions & 8 deletions dbms/src/Storages/DeltaMerge/BitmapFilter/BitmapFilterView.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,13 @@ class BitmapFilterView

inline UInt32 offset() const { return filter_offset; }

// FIXME: This function is not efficient, will be removed in the future.
// Return how many valid rows.
size_t count() const
{
size_t n = 0;
for (UInt32 i = 0; i < size(); i++)
{
if (get(i))
n++;
}
return n;
return std::count(
filter->filter.cbegin() + filter_offset,
filter->filter.cbegin() + filter_offset + filter_size,
true);
}
};

Expand Down

0 comments on commit 9fab7b2

Please sign in to comment.