Skip to content

Commit

Permalink
Remove clone
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Jul 23, 2024
1 parent cc04d92 commit c2e2144
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion py-polars/src/dataframe/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,6 @@ impl PyDataFrame {
requested_schema: Option<PyObject>,
) -> PyResult<Bound<'py, PyCapsule>> {
self.df.align_chunks();
dataframe_to_stream(self.df.clone(), py)
dataframe_to_stream(&self.df, py)
}
}
7 changes: 5 additions & 2 deletions py-polars/src/interop/arrow/to_py.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ pub(crate) fn series_to_stream<'py>(
PyCapsule::new_bound(py, stream, Some(stream_capsule_name))
}

pub(crate) fn dataframe_to_stream(df: DataFrame, py: Python) -> PyResult<Bound<'_, PyCapsule>> {
pub(crate) fn dataframe_to_stream<'py>(
df: &'py DataFrame,
py: Python<'py>,
) -> PyResult<Bound<'py, PyCapsule>> {
let iter = Box::new(DataFrameStreamIterator::new(df));
let field = iter.field();
let stream = ffi::export_iterator(iter, field);
Expand All @@ -87,7 +90,7 @@ pub struct DataFrameStreamIterator {
}

impl DataFrameStreamIterator {
fn new(df: DataFrame) -> Self {
fn new(df: &DataFrame) -> Self {
let schema = df.schema().to_arrow(CompatLevel::newest());
let data_type = ArrowDataType::Struct(schema.fields);

Expand Down

0 comments on commit c2e2144

Please sign in to comment.