1 | #pragma once |
2 | |
3 | #include <Interpreters/BloomFilter.h> |
4 | #include <Storages/MergeTree/MergeTreeIndices.h> |
5 | |
6 | namespace DB |
7 | { |
8 | |
9 | class MergeTreeIndexGranuleBloomFilter : public IMergeTreeIndexGranule |
10 | { |
11 | public: |
12 | MergeTreeIndexGranuleBloomFilter(size_t bits_per_row_, size_t hash_functions_, size_t index_columns_); |
13 | |
14 | MergeTreeIndexGranuleBloomFilter(size_t bits_per_row_, size_t hash_functions_, size_t total_rows_, const Blocks & granule_index_blocks_); |
15 | |
16 | bool empty() const override; |
17 | |
18 | void serializeBinary(WriteBuffer & ostr) const override; |
19 | |
20 | void deserializeBinary(ReadBuffer & istr) override; |
21 | |
22 | const std::vector<BloomFilterPtr> & getFilters() const { return bloom_filters; } |
23 | |
24 | private: |
25 | size_t total_rows; |
26 | size_t bits_per_row; |
27 | size_t hash_functions; |
28 | std::vector<BloomFilterPtr> bloom_filters; |
29 | |
30 | void assertGranuleBlocksStructure(const Blocks & granule_index_blocks) const; |
31 | |
32 | void fillingBloomFilter(BloomFilterPtr & bf, const Block & granule_index_block, size_t index_hash_column); |
33 | }; |
34 | |
35 | |
36 | } |
37 | |