Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use sample bloom filter
Browse files Browse the repository at this point in the history
b41sh committed Jun 12, 2024
1 parent f8dfd91 commit 6f15a20
Showing 18 changed files with 456 additions and 529 deletions.
11 changes: 0 additions & 11 deletions src/query/config/src/config.rs
Original file line number Diff line number Diff line change
@@ -2805,13 +2805,6 @@ pub struct CacheConfig {
)]
pub table_prune_partitions_count: u64,

#[clap(
long = "cache-table-prune-bloom-filter-invalid-keys-count",
value_name = "VALUE",
default_value = "256"
)]
pub table_prune_bloom_filter_invalid_keys_count: u64,

/// Type of data cache storage
#[clap(
long = "cache-data-cache-storage",
@@ -3027,8 +3020,6 @@ mod cache_config_converters {
inverted_index_filter_size: value.inverted_index_filter_size,
inverted_index_filter_memory_ratio: value.inverted_index_filter_memory_ratio,
table_prune_partitions_count: value.table_prune_partitions_count,
table_prune_bloom_filter_invalid_keys_count: value
.table_prune_bloom_filter_invalid_keys_count,
data_cache_storage: value.data_cache_storage.try_into()?,
table_data_cache_population_queue_size: value
.table_data_cache_population_queue_size,
@@ -3055,8 +3046,6 @@ mod cache_config_converters {
inverted_index_filter_size: value.inverted_index_filter_size,
inverted_index_filter_memory_ratio: value.inverted_index_filter_memory_ratio,
table_prune_partitions_count: value.table_prune_partitions_count,
table_prune_bloom_filter_invalid_keys_count: value
.table_prune_bloom_filter_invalid_keys_count,
data_cache_storage: value.data_cache_storage.into(),
data_cache_key_reload_policy: value.data_cache_key_reload_policy.into(),
table_data_cache_population_queue_size: value
4 changes: 0 additions & 4 deletions src/query/config/src/inner.rs
Original file line number Diff line number Diff line change
@@ -530,9 +530,6 @@ pub struct CacheConfig {
/// Max number of cached prune partitions objects. Set it to 0 to disable it.
pub table_prune_partitions_count: u64,

/// Max number of cached prune bloom filter invalid keys objects. Set it to 0 to disable it.
pub table_prune_bloom_filter_invalid_keys_count: u64,

/// Max number of cached bloom index filters. Set it to 0 to disable it.
// One bloom index filter per column of data block being indexed will be generated if necessary.
//
@@ -668,7 +665,6 @@ impl Default for CacheConfig {
inverted_index_filter_size: 2147483648,
inverted_index_filter_memory_ratio: 0,
table_prune_partitions_count: 256,
table_prune_bloom_filter_invalid_keys_count: 256,
data_cache_storage: Default::default(),
table_data_cache_population_queue_size: 0,
disk_cache_config: Default::default(),
2 changes: 1 addition & 1 deletion src/query/expression/src/function.rs
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ pub struct FunctionContext {

pub geometry_output_format: GeometryDataType,
pub parse_datetime_ignore_remainder: bool,
pub bloom_filter_ignore_invalid_key_ratio: Option<f32>,
pub enable_bloom_filter_ignore_invalid_key: bool,
}

#[derive(Clone)]
12 changes: 4 additions & 8 deletions src/query/service/src/sessions/query_ctx.rs
Original file line number Diff line number Diff line change
@@ -698,13 +698,9 @@ impl TableContext for QueryContext {
let disable_variant_check = settings.get_disable_variant_check()?;
let geometry_output_format = settings.get_geometry_output_format()?;
let parse_datetime_ignore_remainder = settings.get_parse_datetime_ignore_remainder()?;
let invalid_key_ratio_value = settings.get_bloom_filter_ignore_invalid_key_ratio()?;
// invalid key ratio is 100 means don't need cache invalid filter keys
let bloom_filter_ignore_invalid_key_ratio = if invalid_key_ratio_value < 100 {
Some(invalid_key_ratio_value as f32 / 100.0)
} else {
None
};
let enable_bloom_filter_ignore_invalid_key =
settings.get_enable_bloom_filter_ignore_invalid_key()?;

let query_config = &GlobalConfig::instance().query;

Ok(FunctionContext {
@@ -725,7 +721,7 @@ impl TableContext for QueryContext {
external_server_request_batch_rows,
geometry_output_format,
parse_datetime_ignore_remainder,
bloom_filter_ignore_invalid_key_ratio,
enable_bloom_filter_ignore_invalid_key,
})
}

Original file line number Diff line number Diff line change
@@ -128,12 +128,10 @@ async fn test_recluster_mutator_block_select() -> Result<()> {
// unused snapshot.
let snapshot = TableSnapshot::new_empty_snapshot(schema.as_ref().clone(), None);

let table_id = 1;
let ctx: Arc<dyn TableContext> = ctx.clone();
let segment_locations = create_segment_location_vector(test_segment_locations, None);
let compact_segments = FuseTable::segment_pruning(
&ctx,
table_id,
schema.clone(),
data_accessor.clone(),
&None,
@@ -259,12 +257,10 @@ async fn test_safety_for_recluster() -> Result<()> {
}
}

let table_id = 1;
let ctx: Arc<dyn TableContext> = ctx.clone();
let segment_locations = create_segment_location_vector(locations.clone(), None);
let compact_segments = FuseTable::segment_pruning(
&ctx,
table_id,
schema.clone(),
data_accessor.clone(),
&None,
Loading

0 comments on commit 6f15a20

Please sign in to comment.