Skip to content

Commit

Permalink
style: fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Sep 25, 2023
1 parent 88e8f37 commit 27dc591
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/mito2/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<CacheValue>()
}
Expand Down
13 changes: 6 additions & 7 deletions src/mito2/src/cache/cache_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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::<usize>();
// 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
Expand Down Expand Up @@ -87,7 +86,7 @@ fn schema_descr_heap_size(descr: &SchemaDescriptor) -> usize {
size += descr
.columns()
.iter()
.map(|descr| mem::size_of::<ColumnDescriptor>() + column_descr_heap_size(&descr))
.map(|descr| mem::size_of::<ColumnDescriptor>() + column_descr_heap_size(descr))
.sum::<usize>();
// leaf_to_base
size += descr.num_columns() * mem::size_of::<usize>();
Expand All @@ -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::<ColumnChunkMetaData>()
mem::size_of_val(meta.columns())
}

/// Returns estimated size of [ParquetColumnIndex] allocated from heap.
Expand Down
3 changes: 2 additions & 1 deletion src/mito2/src/read/scan_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 27dc591

Please sign in to comment.