Skip to content

Commit

Permalink
feat: consider vec size
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Sep 25, 2023
1 parent 5000b41 commit 88e8f37
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/mito2/src/cache/cache_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,26 @@ fn row_group_meta_heap_size(meta: &RowGroupMetaData) -> usize {

/// Returns estimated size of [ParquetColumnIndex] allocated from heap.
fn parquet_column_index_heap_size(column_index: &ParquetColumnIndex) -> usize {
column_index.iter().map(|index| index.len()).sum::<usize>() * mem::size_of::<Index>()
column_index
.iter()
.map(|row_group| row_group.len() * mem::size_of::<Index>() + mem::size_of_val(row_group))
.sum()
}

/// Returns estimated size of [ParquetOffsetIndex] allocated from heap.
fn parquet_offset_index_heap_size(offset_index: &ParquetOffsetIndex) -> usize {
offset_index
.iter()
.map(|index| index.iter().map(|index| index.len()).sum::<usize>())
.sum::<usize>()
* mem::size_of::<PageLocation>()
.map(|row_group| {
row_group
.iter()
.map(|column| {
column.len() * mem::size_of::<PageLocation>() + mem::size_of_val(column)
})
.sum::<usize>()
+ mem::size_of_val(row_group)
})
.sum()
}

#[cfg(test)]
Expand Down

0 comments on commit 88e8f37

Please sign in to comment.