From 27dc591e1b57c3f94ee33064d514f2f0e412f1cd Mon Sep 17 00:00:00 2001 From: evenyag Date: Mon, 25 Sep 2023 20:27:25 +0800 Subject: [PATCH] style: fix clippy --- src/mito2/src/cache.rs | 2 +- src/mito2/src/cache/cache_size.rs | 13 ++++++------- src/mito2/src/read/scan_region.rs | 3 ++- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mito2/src/cache.rs b/src/mito2/src/cache.rs index 5960f80210be..364b1466039a 100644 --- a/src/mito2/src/cache.rs +++ b/src/mito2/src/cache.rs @@ -106,7 +106,7 @@ impl CacheValue { /// Returns memory used by the value (estimated). fn estimated_size(&self) -> usize { let inner_size = match self { - CacheValue::ParquetMeta(meta) => parquet_meta_size(&meta), + CacheValue::ParquetMeta(meta) => parquet_meta_size(meta), }; inner_size + mem::size_of::() } diff --git a/src/mito2/src/cache/cache_size.rs b/src/mito2/src/cache/cache_size.rs index 1620f8203ba1..8ecd2d5e99c6 100644 --- a/src/mito2/src/cache/cache_size.rs +++ b/src/mito2/src/cache/cache_size.rs @@ -17,8 +17,7 @@ use std::mem; use parquet::file::metadata::{ - ColumnChunkMetaData, FileMetaData, ParquetColumnIndex, ParquetMetaData, ParquetOffsetIndex, - RowGroupMetaData, + FileMetaData, ParquetColumnIndex, ParquetMetaData, ParquetOffsetIndex, RowGroupMetaData, }; use parquet::file::page_index::index::Index; use parquet::format::{ColumnOrder, KeyValue, PageLocation}; @@ -34,17 +33,17 @@ pub fn parquet_meta_size(meta: &ParquetMetaData) -> usize { size += meta .row_groups() .iter() - .map(|row_group| row_group_meta_heap_size(row_group)) + .map(row_group_meta_heap_size) .sum::(); // column_index size += meta .column_index() - .map(|index| parquet_column_index_heap_size(index)) + .map(parquet_column_index_heap_size) .unwrap_or(0); // offset_index size += meta .offset_index() - .map(|index| parquet_offset_index_heap_size(index)) + .map(parquet_offset_index_heap_size) .unwrap_or(0); size @@ -87,7 +86,7 @@ fn schema_descr_heap_size(descr: &SchemaDescriptor) -> usize { size += descr .columns() .iter() - .map(|descr| mem::size_of::() + column_descr_heap_size(&descr)) + .map(|descr| mem::size_of::() + column_descr_heap_size(descr)) .sum::(); // leaf_to_base size += descr.num_columns() * mem::size_of::(); @@ -102,7 +101,7 @@ fn column_descr_heap_size(descr: &ColumnDescriptor) -> usize { /// Returns estimated size of [ColumnDescriptor] allocated from heap. fn row_group_meta_heap_size(meta: &RowGroupMetaData) -> usize { - meta.columns().len() * mem::size_of::() + mem::size_of_val(meta.columns()) } /// Returns estimated size of [ParquetColumnIndex] allocated from heap. diff --git a/src/mito2/src/read/scan_region.rs b/src/mito2/src/read/scan_region.rs index 57eb3cb5c550..083238dcd06d 100644 --- a/src/mito2/src/read/scan_region.rs +++ b/src/mito2/src/read/scan_region.rs @@ -186,7 +186,8 @@ impl ScanRegion { .with_time_range(Some(time_range)) .with_predicate(Some(predicate)) .with_memtables(memtables) - .with_files(files); + .with_files(files) + .with_cache(self.cache_manager); Ok(seq_scan) }