Skip to content

Copy-On-Write Support to Support Mutating/Updating Arrays in Place #1981

@tustvold

Description

@tustvold

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAny new improvement worthy of a entry in the changeloghelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions