Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 7 additions & 3 deletions crates/core/src/kernel/snapshot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -270,7 +270,7 @@ impl Snapshot {
log_store: &dyn LogStore,
predicate: Option<PredicateRef>,
) -> 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() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we should byte the bullet and add a config option on the TableConfig so we can change this at runtime. Fine to have the default on false but maybe some queries end up benefitting from stats

Ok(scan) => scan,
Err(err) => return Box::pin(once(ready(Err(err)))),
};
Expand Down Expand Up @@ -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::<Int64Array>(array, "size") {
sum_array_checked::<arrow::array::types::Int64Type, _>(size).unwrap().unwrap_or_default() as usize
sum_array_checked::<arrow::array::types::Int64Type, _>(size)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please find the originating commit and try a fixup on it + force push once this PR gets in, that will make the rebase process simpler

.ok()
.flatten()
.unwrap_or_default()
.max(0) as usize
} else {
0
}
Expand Down
10 changes: 10 additions & 0 deletions crates/core/src/kernel/snapshot/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Scan> {
Ok(Scan::from(self.inner.build()?))
}
Expand Down
Loading