From ec701cd1aad1beb8831b2ee662734ac1b60ff5bc Mon Sep 17 00:00:00 2001 From: Adrian Tanase Date: Sat, 14 Mar 2026 22:24:15 +0200 Subject: [PATCH 1/2] [HSTACK] - add skip_stas (backported from delta-kernel 0.20) Signed-off-by: Adrian Tanase --- Cargo.toml | 2 +- crates/core/src/kernel/snapshot/mod.rs | 2 +- crates/core/src/kernel/snapshot/scan.rs | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9d77d59c24..71875327f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ documentation = "https://docs.rs/deltalake" repository = "https://github.com/delta-io/delta.rs" [workspace.dependencies] -delta_kernel = { version = "0.19.0", features = [ +delta_kernel = { version = "0.19.2", features = [ "arrow-57", "default-engine-rustls", "internal-api", diff --git a/crates/core/src/kernel/snapshot/mod.rs b/crates/core/src/kernel/snapshot/mod.rs index 08eb796182..a1ed18d376 100644 --- a/crates/core/src/kernel/snapshot/mod.rs +++ b/crates/core/src/kernel/snapshot/mod.rs @@ -270,7 +270,7 @@ impl Snapshot { log_store: &dyn LogStore, predicate: Option, ) -> SendableRBStream { - let scan = match self.scan_builder().with_predicate(predicate).build() { + let scan = match self.scan_builder().with_predicate(predicate).with_skip_stats(true).build() { Ok(scan) => scan, Err(err) => return Box::pin(once(ready(Err(err)))), }; diff --git a/crates/core/src/kernel/snapshot/scan.rs b/crates/core/src/kernel/snapshot/scan.rs index 87d5b235de..1182aa3bd1 100644 --- a/crates/core/src/kernel/snapshot/scan.rs +++ b/crates/core/src/kernel/snapshot/scan.rs @@ -63,6 +63,16 @@ impl ScanBuilder { self } + /// Skip reading file statistics from checkpoint parquet files. + /// + /// When enabled, the stats column is not read from checkpoint files and data skipping + /// is disabled. This is useful when the caller handles data skipping externally or + /// doesn't need file statistics. + pub fn with_skip_stats(mut self, skip_stats: bool) -> Self { + self.inner = self.inner.with_skip_stats(skip_stats); + self + } + pub fn build(self) -> DeltaResult { Ok(Scan::from(self.inner.build()?)) } From b636501e58bf0f3151c1e3b96d5c52d205f51463 Mon Sep 17 00:00:00 2001 From: Radu Stoenescu Date: Thu, 9 Apr 2026 14:33:56 +0300 Subject: [PATCH 2/2] [HSTACK] - fixup: remove unused StructArray import, harden read_adds_size - Remove unused StructArray import - Replace unwrap() with ok().flatten() on sum_array_checked to avoid panic on arithmetic overflow - Clamp negative i64 to 0 before casting to usize --- crates/core/src/kernel/snapshot/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/core/src/kernel/snapshot/mod.rs b/crates/core/src/kernel/snapshot/mod.rs index a1ed18d376..3735b4ba0b 100644 --- a/crates/core/src/kernel/snapshot/mod.rs +++ b/crates/core/src/kernel/snapshot/mod.rs @@ -21,7 +21,7 @@ use arrow::array::RecordBatch; use arrow::compute::{filter_record_batch, is_not_null}; use arrow::datatypes::SchemaRef; use arrow_arith::aggregate::sum_array_checked; -use arrow_array::{Int64Array, StructArray}; +use arrow_array::Int64Array; use delta_kernel::actions::{Remove, Sidecar}; use delta_kernel::engine::arrow_conversion::TryIntoArrow as _; use delta_kernel::engine::arrow_data::ArrowEngineData; @@ -552,7 +552,11 @@ pub(crate) async fn resolve_snapshot( fn read_adds_size(array: &dyn ProvidesColumnByName) -> usize { if let Some(size) = ex::extract_and_cast_opt::(array, "size") { - sum_array_checked::(size).unwrap().unwrap_or_default() as usize + sum_array_checked::(size) + .ok() + .flatten() + .unwrap_or_default() + .max(0) as usize } else { 0 }