Skip to content

Expose ArrayRef::inner_mut() and ArrayInner fields as public - #8947

Closed
evanlhatch wants to merge 2 commits into
vortex-data:developfrom
evanlhatch:patch-2
Closed

evanlhatch wants to merge 2 commits into
vortex-data:developfrom
evanlhatch:patch-2

Conversation

@evanlhatch

@evanlhatch evanlhatch commented Jul 24, 2026 •

Copy link
Copy Markdown

Motivation

For use cases that hold a unique ArrayRef (refcount 1) and want to mutate the underlying buffer in-place, there is currently no public API. The only path is try_into_parts() → try_into_buffer_mut() → mutate → freeze() → from_buffer_handle() → from_parts_unchecked() — which allocates a new Arc and a new ArrayInner every time, even though the original could be mutated in-place.

This is relevant for low-latency applications that mutate columns every tick and hold sole ownership of each ArrayRef.

Changes

  • ArrayRef::inner_mut(): pub(crate) → pub
  • ArrayRef::from_inner(): pub(crate) → pub
  • ArrayRef::dyn_array(): pub(crate) → pub
  • ArrayInner struct + fields: pub(crate) → pub

These are visibility widenings only — no logic changes, no API breaks, no behavioral changes.

Usage

let mut field: ArrayRef = columns.take(idx);
if let Some(inner) = field.inner_mut() {
    // Mutate the buffer in-place. Same Arc, same allocation.
    // No try_into_parts, no from_parts_unchecked, no Arc::new.
}
columns.put(idx, field); // same ArrayRef goes back

Signed-off-by: Evan Hatch <44220750+evanlhatch@users.noreply.github.com>
Signed-off-by: Evan Hatch <44220750+evanlhatch@users.noreply.github.com>
@joseph-isaacs

Copy link
Copy Markdown
Contributor

I would really like to be support this functionally without exposing that internal value.

What do you want this for exactly. Reusing allocated arrays or do decompress a buffer in-place?

@joseph-isaacs

Copy link
Copy Markdown
Contributor

Could we move this into an issue first?

@evanlhatch evanlhatch closed this Jul 26, 2026
@evanlhatch
evanlhatch deleted the patch-2 branch July 26, 2026 13:39
@evanlhatch

evanlhatch commented Jul 27, 2026 •

Copy link
Copy Markdown
Author

Could we move this into an issue first?

Sure, I made new issue 8696 touching on this

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants