-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changeloghelp wanted
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Certain use-cases may benefit from being able to mutate arrays in place, without copying them. Fortunately we have most of the pieces to support this, it just requires some plumbing work.
Describe the solution you'd like
A high-level outline can be found below:
- Add COW conversion from
BuffertoMutableBufferlikely usingArc::try_unwrap - Add COW conversion from
T: Arrayto their corresponding builder, i.e.PrimitiveArray::into_builder - Add conversion from
ArrayReftoArc<T>- https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=abb7fcf97e33ba83d44b17f6c89e8f0b
It should then be possible to do something like (likely encapsulated in a nicer interface)
fn cow_builder(col: ArrayRef) -> Int32Builder {
let col: Arc<Int32Array> = downcast_array(col).unwrap();
let col: Int32Array = Arc::try_unwrap(col).unwrap_or_else(|_| col.as_ref().clone());
col.into_builder()
}
Additional context
Arrow2 recently merged a form of support for this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changeloghelp wanted