Expose the null buffer of every builder that has one #5754
Merged
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?
Closes #5749.
Rationale for this change
This makes the interface of different builder types more consistent, and enables exposing builder contents as a slice in more cases in my prototype for #5700.
What changes are included in this PR?
Overall, my general process was to look at what
append_null()
/append(false)
pushes the null into, and expose the corresponding null buffer.BooleanBuilder
andPrimitiveBuilder
.append_null()
.This only leaves the following builders without a null buffer accessor after this PR:
XyzRunBuilder
: For these builder types, the null buffer is per-run, not per-element. It is not yet clear to me if/how that should be exposed, so I'm leaving this for a future PR.UnionBuilder
: For this builder type, each variant has its own null buffer, so there is no notion of builder-wide null buffer. This would be best handled by exposing some sort of access to the storage of individual variants, but again, this requires more design work, so I'm leaving it for a future PR.Are there any user-facing changes?
More builders expose a
validity_slice(&self) -> Option<&[u8]>
method. Since the semantics are identical to pre-existing methods from other builders with this name, the documentation was copy-pasted from there.