diff --git a/src/mito2/src/cache/cache_size.rs b/src/mito2/src/cache/cache_size.rs index 0dbd1ef5524c..1620f8203ba1 100644 --- a/src/mito2/src/cache/cache_size.rs +++ b/src/mito2/src/cache/cache_size.rs @@ -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::() * mem::size_of::() + column_index + .iter() + .map(|row_group| row_group.len() * mem::size_of::() + 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::()) - .sum::() - * mem::size_of::() + .map(|row_group| { + row_group + .iter() + .map(|column| { + column.len() * mem::size_of::() + mem::size_of_val(column) + }) + .sum::() + + mem::size_of_val(row_group) + }) + .sum() } #[cfg(test)]