Skip to content
Merged
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
7 changes: 4 additions & 3 deletions datafusion/datasource/src/file_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::collections::BinaryHeap;
use std::iter::repeat_with;
use std::mem;
use std::ops::{Index, IndexMut};
use std::sync::Arc;

/// Repartition input files into `target_partitions` partitions, if total file size exceed
/// `repartition_file_min_size`
Expand Down Expand Up @@ -368,7 +369,7 @@ pub struct FileGroup {
/// The files in this group
files: Vec<PartitionedFile>,
/// Optional statistics for the data across all files in the group
statistics: Option<Statistics>,
statistics: Option<Arc<Statistics>>,
}

impl FileGroup {
Expand All @@ -386,7 +387,7 @@ impl FileGroup {
}

/// Set the statistics for this group
pub fn with_statistics(mut self, statistics: Statistics) -> Self {
pub fn with_statistics(mut self, statistics: Arc<Statistics>) -> Self {
self.statistics = Some(statistics);
self
}
Expand Down Expand Up @@ -420,7 +421,7 @@ impl FileGroup {

/// Get the statistics for this group
pub fn statistics(&self) -> Option<&Statistics> {
self.statistics.as_ref()
self.statistics.as_deref()
}

/// Partition the list of files into `n` groups
Expand Down
2 changes: 1 addition & 1 deletion datafusion/datasource/src/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ pub fn compute_file_group_statistics(
file.statistics.as_ref().map(|stats| stats.as_ref())
});

Ok(file_group.with_statistics(statistics))
Ok(file_group.with_statistics(Arc::new(statistics)))
}

/// Computes statistics for all files across multiple file groups.
Expand Down