Skip to content

Compact run buffer slice values#10292

Draft
Jefffrey wants to merge 2 commits into
apache:mainfrom
Jefffrey:compact_run_slice
Draft

Compact run buffer slice values#10292
Jefffrey wants to merge 2 commits into
apache:mainfrom
Jefffrey:compact_run_slice

Conversation

@Jefffrey

@Jefffrey Jefffrey commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added the arrow Changes to the arrow crate label Jul 6, 2026
"the length + offset of the sliced RunEndBuffer cannot exceed the existing length"
);
Self {
let logical_offset = self.logical_offset + logical_offset;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @Rich-T-kid this is what i was thinking on my previous comments on your PR

essentially we can still reduce how many physical values we hold on to, without needing to readjust all of the values (still keeping it zero-copy)

we'd need to extend it to runarray too since need to ensure the values array is similarly compacted (might need a bit of plumbing to make it work) and as noted in the issue callsites may need to be adjusted

lemme know your thoughts

@Rich-T-kid

Copy link
Copy Markdown
Contributor

will take a look this afternoon!

Comment on lines +449 to +452
// [B, B, B, B, B, B, {B, B, C, C, C, C}]
let slice = buffer.slice(6, 6);
assert_eq!(slice.len(), 6);
assert_eq!(slice.offset(), 6);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i realized my initial version of the PR incorrectly adjusted the offset when that wasnt needed; by removing the first physical value its as if the first run was consumed by the following run since we always list run lengths; that is

[4, 8] -> AAAABBBB
[8] -> {BBBB}BBBB
  • where {BBBB} used to be a separate run but is now folded into the first run; this shouldnt matter as our logical offset points beyond it anyway

@Rich-T-kid

Copy link
Copy Markdown
Contributor

Going to review this PR this week 👍

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.

RunArray::slice() should align run_ends and values with the logical slice

2 participants