Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(rust): Add new streaming CSV source #19694

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions crates/polars-plan/src/plans/optimizer/slice_pushdown_lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,30 @@ impl SlicePushDown {
Ok(lp)
}
#[cfg(feature = "csv")]
(Scan {
sources,
file_info,
hive_parts,
output_schema,
mut file_options,
predicate,
scan_type: FileScan::Csv { options, cloud_options },
}, Some(state)) if predicate.is_none() && self.new_streaming => {
file_options.slice = Some((state.offset, state.len as usize));

let lp = Scan {
sources,
file_info,
hive_parts,
output_schema,
scan_type: FileScan::Csv { options, cloud_options },
file_options,
predicate,
};

Ok(lp)
},
#[cfg(feature = "csv")]
(Scan {
sources,
file_info,
Expand Down
28 changes: 28 additions & 0 deletions crates/polars-stream/src/async_primitives/wait_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,34 @@ impl WaitGroup {
}
}

// Wait group with an associated index.
pub struct IndexedWaitGroup {
index: usize,
wait_group: WaitGroup,
}

impl IndexedWaitGroup {
pub fn new(index: usize) -> Self {
Self {
index,
wait_group: Default::default(),
}
}

pub fn index(&self) -> usize {
self.index
}

pub fn token(&self) -> WaitToken {
self.wait_group.token()
}

pub async fn wait(self) -> Self {
self.wait_group.wait().await;
self
}
}

struct WaitGroupFuture<'a> {
inner: &'a Arc<WaitGroupInner>,
}
Expand Down
Loading