tustvold opened a new issue, #1981:
URL: https://github.com/apache/arrow-rs/issues/1981

   **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 `Buffer` to `MutableBuffer` likely using 
[`Arc::try_unwrap`](https://doc.rust-lang.org/std/sync/struct.Arc.html#method.try_unwrap)
   * Add COW conversion from `T: Array` to their corresponding builder, i.e. 
`PrimitiveArray::into_builder`
   * Add conversion from `ArrayRef` to `Arc<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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to