Expose builder buffer capacity accessors#10342
Merged
Merged
Conversation
Weijun-H
marked this pull request as ready for review
July 14, 2026 14:30
Jefffrey
approved these changes
Jul 15, 2026
Contributor
|
thanks @Weijun-H, @rluvaton & @Rich-T-kid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Downstream memory accounting sometimes needs to measure the allocated capacity currently retained by Arrow array builders, including allocation slack after buffer growth. Existing slice accessors expose initialized data, but not the underlying values, offsets, or validity-buffer capacity.
What changes are included in this PR?
This adds read-only capacity accessors for existing builder internals:
GenericByteBuilder::{values_capacity, offsets_capacity, validity_capacity}GenericListBuilder::{offsets_capacity, validity_capacity}PrimitiveBuilder::validity_capacityStructBuilder::validity_capacityThe methods only read existing builder state and do not change append, reserve, finish, or resize behavior.
Are these changes tested?
No behavior-specific tests are added because these methods only expose existing capacity fields through read-only forwarding accessors. Existing arrow-array builder tests were run unchanged, and the new public API is compile-checked by the crate.
Validated with:
cargo fmt --all -- --checkcargo test -p arrow-array builder --libcargo test -p arrow-array --libcargo +1.96.0 clippy -p arrow-array --all-targets --no-deps -- -D warningsAre there any user-facing changes?
Yes. This adds public read-only capacity accessors on Arrow array builders.