Skip to content

Commit b7e9ac0

Browse files
dvlascencoVLCDaniel
authored andcommitted
fixup: calculation of total file size
1 parent dc18fec commit b7e9ac0

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • crates/core/src/kernel/snapshot

crates/core/src/kernel/snapshot/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,11 @@ pub(crate) async fn resolve_snapshot(
550550
}
551551
}
552552

553-
fn read_adds_size(array: &dyn ProvidesColumnByName) -> DeltaResult<usize> {
554-
if let Some(arr) = ex::extract_and_cast_opt::<StructArray>(array, "add") {
555-
let size = ex::extract_and_cast::<Int64Array>(arr, "size")?;
556-
let sum = sum_array_checked::<arrow::array::types::Int64Type, _>(size)?.unwrap_or_default();
557-
Ok(sum as usize)
553+
fn read_adds_size(array: &dyn ProvidesColumnByName) -> usize {
554+
if let Some(size) = ex::extract_and_cast_opt::<Int64Array>(array, "size") {
555+
sum_array_checked::<arrow::array::types::Int64Type, _>(size).unwrap().unwrap_or_default() as usize
558556
} else {
559-
Ok(0)
557+
0
560558
}
561559
}
562560

@@ -716,7 +714,7 @@ impl EagerSnapshot {
716714
self
717715
.files
718716
.iter()
719-
.map(|frb| read_adds_size(frb).unwrap_or_default())
717+
.map(|frb| read_adds_size(frb))
720718
.sum()
721719
}
722720

0 commit comments

Comments
 (0)