mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-25 09:20:40 +00:00
resolve tiny cr comments
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
6
src/mito2/src/cache/index/result_cache.rs
vendored
6
src/mito2/src/cache/index/result_cache.rs
vendored
@@ -258,8 +258,10 @@ pub struct MinMaxKey {
|
||||
|
||||
impl MinMaxKey {
|
||||
pub fn new(exprs: Arc<Vec<String>>, schema_version: u64, skip_fields: bool) -> Self {
|
||||
let mem_usage =
|
||||
exprs.iter().map(|s| s.len()).sum::<usize>() + size_of::<u64>() + size_of::<bool>();
|
||||
let mem_usage = size_of::<Self>()
|
||||
+ size_of::<Vec<String>>()
|
||||
+ exprs.len() * size_of::<String>()
|
||||
+ exprs.iter().map(|s| s.len()).sum::<usize>();
|
||||
Self {
|
||||
exprs,
|
||||
schema_version,
|
||||
|
||||
@@ -182,6 +182,10 @@ pub(crate) struct ScanMetricsSet {
|
||||
bloom_filter_cache_hit: usize,
|
||||
/// Number of index result cache misses for bloom filter index.
|
||||
bloom_filter_cache_miss: usize,
|
||||
/// Number of index result cache hits for minmax pruning.
|
||||
minmax_cache_hit: usize,
|
||||
/// Number of index result cache misses for minmax pruning.
|
||||
minmax_cache_miss: usize,
|
||||
/// Number of pruner builder cache hits.
|
||||
pruner_cache_hit: usize,
|
||||
/// Number of pruner builder cache misses.
|
||||
@@ -308,6 +312,8 @@ impl fmt::Debug for ScanMetricsSet {
|
||||
inverted_index_cache_miss,
|
||||
bloom_filter_cache_hit,
|
||||
bloom_filter_cache_miss,
|
||||
minmax_cache_hit,
|
||||
minmax_cache_miss,
|
||||
pruner_cache_hit,
|
||||
pruner_cache_miss,
|
||||
pruner_prune_cost,
|
||||
@@ -433,6 +439,12 @@ impl fmt::Debug for ScanMetricsSet {
|
||||
if *bloom_filter_cache_miss > 0 {
|
||||
write!(f, ", \"bloom_filter_cache_miss\":{bloom_filter_cache_miss}")?;
|
||||
}
|
||||
if *minmax_cache_hit > 0 {
|
||||
write!(f, ", \"minmax_cache_hit\":{minmax_cache_hit}")?;
|
||||
}
|
||||
if *minmax_cache_miss > 0 {
|
||||
write!(f, ", \"minmax_cache_miss\":{minmax_cache_miss}")?;
|
||||
}
|
||||
if *pruner_cache_hit > 0 {
|
||||
write!(f, ", \"pruner_cache_hit\":{pruner_cache_hit}")?;
|
||||
}
|
||||
@@ -639,6 +651,8 @@ impl ScanMetricsSet {
|
||||
inverted_index_cache_miss,
|
||||
bloom_filter_cache_hit,
|
||||
bloom_filter_cache_miss,
|
||||
minmax_cache_hit,
|
||||
minmax_cache_miss,
|
||||
pruner_cache_hit,
|
||||
pruner_cache_miss,
|
||||
pruner_prune_cost,
|
||||
@@ -680,6 +694,8 @@ impl ScanMetricsSet {
|
||||
self.inverted_index_cache_miss += *inverted_index_cache_miss;
|
||||
self.bloom_filter_cache_hit += *bloom_filter_cache_hit;
|
||||
self.bloom_filter_cache_miss += *bloom_filter_cache_miss;
|
||||
self.minmax_cache_hit += *minmax_cache_hit;
|
||||
self.minmax_cache_miss += *minmax_cache_miss;
|
||||
self.pruner_cache_hit += *pruner_cache_hit;
|
||||
self.pruner_cache_miss += *pruner_cache_miss;
|
||||
self.pruner_prune_cost += *pruner_prune_cost;
|
||||
|
||||
@@ -1177,11 +1177,16 @@ impl ParquetReaderBuilder {
|
||||
|
||||
if let Some(index_result_cache) = index_result_cache
|
||||
&& let Some(predicate_key) = cached_minmax_key.as_ref()
|
||||
&& let Some(result) = index_result_cache.get(predicate_key, file_id)
|
||||
{
|
||||
let num_row_groups = parquet_meta.num_row_groups();
|
||||
metrics.rg_minmax_filtered += num_row_groups.saturating_sub(result.row_group_count());
|
||||
return (*result).clone();
|
||||
if let Some(result) = index_result_cache.get(predicate_key, file_id) {
|
||||
metrics.minmax_cache_hit += 1;
|
||||
let num_row_groups = parquet_meta.num_row_groups();
|
||||
metrics.rg_minmax_filtered +=
|
||||
num_row_groups.saturating_sub(result.row_group_count());
|
||||
return (*result).clone();
|
||||
}
|
||||
|
||||
metrics.minmax_cache_miss += 1;
|
||||
}
|
||||
|
||||
let region_meta = read_format.metadata();
|
||||
@@ -1334,6 +1339,10 @@ pub(crate) struct ReaderFilterMetrics {
|
||||
pub(crate) bloom_filter_cache_hit: usize,
|
||||
/// Number of index result cache misses for bloom filter index.
|
||||
pub(crate) bloom_filter_cache_miss: usize,
|
||||
/// Number of index result cache hits for minmax pruning.
|
||||
pub(crate) minmax_cache_hit: usize,
|
||||
/// Number of index result cache misses for minmax pruning.
|
||||
pub(crate) minmax_cache_miss: usize,
|
||||
|
||||
/// Optional metrics for inverted index applier.
|
||||
pub(crate) inverted_index_apply_metrics: Option<InvertedIndexApplyMetrics>,
|
||||
@@ -1374,6 +1383,8 @@ impl ReaderFilterMetrics {
|
||||
self.inverted_index_cache_miss += other.inverted_index_cache_miss;
|
||||
self.bloom_filter_cache_hit += other.bloom_filter_cache_hit;
|
||||
self.bloom_filter_cache_miss += other.bloom_filter_cache_miss;
|
||||
self.minmax_cache_hit += other.minmax_cache_hit;
|
||||
self.minmax_cache_miss += other.minmax_cache_miss;
|
||||
|
||||
self.pruner_cache_hit += other.pruner_cache_hit;
|
||||
self.pruner_cache_miss += other.pruner_cache_miss;
|
||||
|
||||
Reference in New Issue
Block a user