Skip to content

Commit

Permalink
no need for Pin in amortized iter, boxes don't move
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jan 10, 2022
1 parent 01469d4 commit 2bbc851
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions polars/polars-core/src/chunked_array/list/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ use crate::utils::CustomIterTools;
use arrow::array::ArrayRef;
use std::convert::TryFrom;
use std::marker::PhantomData;
use std::pin::Pin;
use std::ptr::NonNull;

#[cfg(feature = "private")]
pub struct AmortizedListIter<'a, I: Iterator<Item = Option<ArrayBox>>> {
len: usize,
series_container: Pin<Box<Series>>,
series_container: Box<Series>,
inner: NonNull<ArrayRef>,
lifetime: PhantomData<&'a ArrayRef>,
iter: I,
Expand Down Expand Up @@ -68,7 +67,7 @@ impl ListChunked {
// so that the container has the proper dtype.
let arr = self.downcast_iter().next().unwrap();
let inner_values = arr.values();
let series_container = Box::pin(Series::try_from(("", inner_values.clone())).unwrap());
let series_container = Box::new(Series::try_from(("", inner_values.clone())).unwrap());

let ptr = &series_container.chunks()[0] as *const ArrayRef as *mut ArrayRef;

Expand Down

0 comments on commit 2bbc851

Please sign in to comment.