Skip to content

Add PrimitiveArray mut-or-clone helpers#9707

Draft
alamb wants to merge 3 commits intoapache:mainfrom
alamb:alamb/primitive-array-mut-or-clone
Draft

Add PrimitiveArray mut-or-clone helpers#9707
alamb wants to merge 3 commits intoapache:mainfrom
alamb:alamb/primitive-array-mut-or-clone

Conversation

@alamb
Copy link
Copy Markdown
Contributor

@alamb alamb commented Apr 13, 2026

Which issue does this PR close?

Rationale for this change

Inspired by @mbutrovich in

I want to add some helper methods to the PrimitiveArray to make it easier to modify in place when possible, and clone when not possible.

What changes are included in this PR?

Add the equivalent APIs primitive_array:

  1. PrimitiveArray::unary_mut_or_clone
  2. PrimitiveArray::try_unary_mut_or_clone
  3. PrimitiveArray::binary_mut_or_clone
  4. PrimitiveArray::try_binary_mut_or_clone

Along with doc examples and pointer-reuse tests. It also factors arrow::compute::binary through the shared PrimitiveArray binary implementation.

Are these changes tested?

Yes by CI

Are there any user-facing changes?

Yes. New APIs

@github-actions github-actions bot added the arrow Changes to the arrow crate label Apr 13, 2026
@alamb alamb force-pushed the alamb/primitive-array-mut-or-clone branch from 27a36b4 to f288169 Compare April 13, 2026 20:19
@alamb alamb changed the title [arrow-array]: add PrimitiveArray mut-or-clone helpers Add PrimitiveArray mut-or-clone helpers Apr 13, 2026
@alamb
Copy link
Copy Markdown
Contributor Author

alamb commented Apr 13, 2026

I would like to to try and use these downstream in datafusion before marking this PR ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hard to use PrimitiveArray::unary_mut, PrimitiveArray:try_unary_mut, etc

1 participant