Skip to content

Commit ef24126

Browse files
committed
chore: FilterImpl uses Xor8Filter instead
Signed-off-by: Kould <kould2333@gmail.com>
1 parent 6ed13ee commit ef24126

File tree

16 files changed

+577
-481
lines changed

16 files changed

+577
-481
lines changed

Cargo.lock

+4-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ bincode = { version = "2.0.0-rc.3", features = ["serde", "std", "alloc"] }
262262
bincode_v1 = { package = "bincode", version = "1.3.3" }
263263
bitpacking = "0.8.0"
264264
blake3 = "1.3.1"
265-
bloomfilter = { version = "3.0.1", features = ["serde"] }
266265
bollard = { version = "0.17" }
267266
borsh = { version = "1.2.1", features = ["derive"] }
268267
brotli = "3.3"

src/query/storages/common/cache/src/caches.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::time::Instant;
1818

1919
use arrow::array::ArrayRef;
2020
use databend_common_cache::MemSized;
21-
use databend_storages_common_index::filters::FilterImpl;
2221

2322
pub use crate::cache_items::*;
2423
use crate::manager::CacheManager;
@@ -46,7 +45,7 @@ pub type TableSnapshotCache = InMemoryLruCache<TableSnapshot>;
4645
pub type TableSnapshotStatisticCache = InMemoryLruCache<TableSnapshotStatistics>;
4746
/// In memory object cache of bloom filter.
4847
/// For each indexed data block, the bloom xor8 filter of column is cached individually
49-
pub type BloomIndexFilterCache = HybridCache<FilterImpl>;
48+
pub type BloomIndexFilterCache = HybridCache<Xor8Filter>;
5049
/// In memory object cache of parquet FileMetaData of bloom index data
5150
pub type BloomIndexMetaCache = HybridCache<BloomIndexMeta>;
5251

@@ -124,7 +123,7 @@ impl CachedObject<(PartStatistics, Partitions)> for (PartStatistics, Partitions)
124123
}
125124
}
126125

127-
impl CachedObject<FilterImpl> for FilterImpl {
126+
impl CachedObject<Xor8Filter> for Xor8Filter {
128127
type Cache = BloomIndexFilterCache;
129128
fn cache() -> Option<Self::Cache> {
130129
CacheManager::instance().get_bloom_index_filter_cache()
@@ -236,10 +235,10 @@ impl From<TableSnapshotStatistics> for CacheValue<TableSnapshotStatistics> {
236235
}
237236
}
238237

239-
impl From<FilterImpl> for CacheValue<FilterImpl> {
240-
fn from(value: FilterImpl) -> Self {
238+
impl From<Xor8Filter> for CacheValue<Xor8Filter> {
239+
fn from(value: Xor8Filter) -> Self {
241240
CacheValue {
242-
mem_bytes: value.mem_bytes(),
241+
mem_bytes: std::mem::size_of::<Xor8Filter>() + value.filter.finger_prints.len(),
243242
inner: Arc::new(value),
244243
}
245244
}

src/query/storages/common/index/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ databend-storages-common-table-meta = { workspace = true }
1818

1919
anyerror = { workspace = true }
2020
bincode = { workspace = true, features = ["serde"] }
21-
bloomfilter = { workspace = true, features = ["serde"] }
2221
bytes = { workspace = true }
2322
cbordata = { workspace = true }
2423
fastrace = { workspace = true }

0 commit comments

Comments
 (0)