You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
We then need to use as_any() -> clone and drop the owned dyn Array to drop the ref count again.
Here an excerpt of what we do in polars:
// Depending on the state of the underlying arrow array we// might be able to get a `MutablePrimitiveArray`//// This is only possible if the reference count of the array and its buffers are 1// So the logic below is needed to keep the reference count 1 if it is// First we must obtain an owned version of the arraylet arr = self.downcast_iter().next().unwrap();// increments 1let arr = arr.clone();// now we drop our owned ArrayRefs so that// decrements 1{self.chunks.clear();}
What I'd ideally like as an api would be:
let owned = std::mem::take(array.as_any_mut().downcast_mut::<PrimitiveArray<T>>())?;
owned.into_mut()
Then a Default implementation could be an empty array from that same type. This is similar to standard data collections in std.
Is this something we could add to the Array trait? I am willing to make a PR.
The text was updated successfully, but these errors were encountered:
The new
into_mut
works like a charm. <3But its quite hacky to make work with
dyn Array
.We then need to use
as_any()
->clone
anddrop
the owneddyn Array
to drop the ref count again.Here an excerpt of what we do in polars:
What I'd ideally like as an api would be:
Then a
Default
implementation could be an empty array from that same type. This is similar to standard data collections instd
.Is this something we could add to the
Array
trait? I am willing to make a PR.The text was updated successfully, but these errors were encountered: