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

feat: Add IPC source node for new streaming engine #19454

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions crates/polars-arrow/src/io/ipc/read/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ impl<R: Read + Seek> FileReader<R> {
self.reader
}

pub fn set_current_block(&mut self, idx: usize) {
self.current_block = idx;
}

/// Get the inner memory scratches so they can be reused in a new writer.
/// This can be utilized to save memory allocations for performance reasons.
pub fn get_scratches(&mut self) -> (Vec<u8>, Vec<u8>) {
Expand Down
8 changes: 4 additions & 4 deletions crates/polars-io/src/utils/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn get_reader_bytes<R: Read + MmapBytesReader + ?Sized>(
feature = "parquet",
feature = "avro"
))]
pub(crate) fn apply_projection(schema: &ArrowSchema, projection: &[usize]) -> ArrowSchema {
pub fn apply_projection(schema: &ArrowSchema, projection: &[usize]) -> ArrowSchema {
projection
.iter()
.map(|idx| schema.get_at_index(*idx).unwrap())
Expand All @@ -59,14 +59,14 @@ pub(crate) fn apply_projection(schema: &ArrowSchema, projection: &[usize]) -> Ar
feature = "avro",
feature = "parquet"
))]
pub(crate) fn columns_to_projection(
columns: &[String],
pub fn columns_to_projection<T: AsRef<str>>(
columns: &[T],
schema: &ArrowSchema,
) -> PolarsResult<Vec<usize>> {
let mut prj = Vec::with_capacity(columns.len());

for column in columns {
let i = schema.try_index_of(column)?;
let i = schema.try_index_of(column.as_ref())?;
prj.push(i);
}

Expand Down
Loading
Loading