apache / apache/arrow-rs

Add `into_builder` methods for Arrays

Open
#6,430 13 comments 0 reactions 1 assignee Claimed by @Rich-T-kid View on GitHub
enhancement
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 14h
Merged PRs (30d)
167

Description

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
While working with various arrays and builders in DataFusion one thing that we often want to do is convert between an array and some modifiable version of it (for example, in StringView trim it would be nice to just modify existing views rather than mutate them)

I think in general it would be good to use the various Builder APIs for this

**Describe the solution you'd like**

I would like all the Arrays to have equivalent methods to [`PrimitiveArray::into_builder()`](https://docs.rs/arrow/latest/arrow/array/struct.PrimitiveArray.html#method.into_builder).

Like I want to be able to do
```rust
let array: StringViewArray = ...;
let builder = array.into_builder();
// mutate the builder (more APIs TBD)
// recreate the array
let array = builder.build()
```

Similarly it would be nice to do something similar with `BooleanBuiler`, possibly other arrays

**Describe alternatives you've considered**

**Additional context**
Example DataFusion PRs: https://github.com/apache/datafusion/pull/12395

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.