Skip to content
Draft
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion vortex-file/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ use itertools::Itertools;
use vortex_array::ArrayRef;
use vortex_array::dtype::DType;
use vortex_array::dtype::FieldMask;
use vortex_array::expr::BoundExpression;
use vortex_array::expr::Expression;
use vortex_buffer::ByteBuffer;
use vortex_error::VortexResult;
use vortex_layout::LayoutReader;
use vortex_layout::scan::layout::LayoutReaderDataSource;
use vortex_layout::scan::metrics::ScanUsage;
use vortex_layout::scan::scan_builder::ScanBuilder;
use vortex_layout::scan::scan_builder::referenced_field_masks;
use vortex_layout::scan::split_by::SplitBy;
use vortex_layout::scan::v2::ScanFile;
use vortex_layout::segments::SegmentSource;
Expand Down Expand Up @@ -310,8 +312,25 @@ impl VortexFile {

/// This file as a child of a [`PlanDataSource`]: its V2 scan input, row count, and a pruner
/// that skips scans whose filter the file-level statistics prove false.
///
/// An opened scan of the child cuts its work on the file's layout splits over the fields it
/// reads, as a V1 scan of the same fields does.
pub fn plan_child(&self) -> PlanChild {
let file = PlanChild::new(self.scan_file().into()).with_row_count(self.row_count());
let splitter = {
let file = self.clone();
Arc::new(
move |projection: &BoundExpression, filter: Option<&BoundExpression>| {
SplitBy::default().splits(
file.layout_reader()?.as_ref(),
&(0..file.row_count()),
&referenced_field_masks(projection, filter)?,
)
},
)
};
let file = PlanChild::new(self.scan_file().into())
.with_row_count(self.row_count())
.with_splitter(splitter);
let Some(statistics) = self.file_stats().cloned() else {
return file;
};
Expand Down
2 changes: 2 additions & 0 deletions vortex-file/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ pub mod flatbuffers;
mod footer;
pub mod multi;
mod open;
#[cfg(test)]
mod plan_tests;
mod pruning;
/// Segment sources, caches, and sinks used by file readers and writers.
pub mod segments;
Expand Down
Loading
Loading