GH-50260: [C++] Add ComputeLogicalNullCount to ChunkedArray#50261
Open
goel-skd wants to merge 1 commit into
Open
GH-50260: [C++] Add ComputeLogicalNullCount to ChunkedArray#50261goel-skd wants to merge 1 commit into
goel-skd wants to merge 1 commit into
Conversation
ChunkedArray exposed null_count() but had no equivalent of Array::ComputeLogicalNullCount, forcing callers to hand-roll a loop over chunks to account for logical nulls in types without a validity bitmap (unions, run-end encoded arrays). Add ChunkedArray::ComputeLogicalNullCount() that returns the sum of the per-chunk logical null counts. Like the Array-level method, it is recomputed on every call rather than cached. Covered by a new TestChunkedArray test exercising a validity-bitmap type, an empty chunked array, and a run-end encoded chunked array.
|
|
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.
Rationale for this change
ArrayandArrayDataexposeComputeLogicalNullCount(), which counts logical nulls for types that carry them without a validity bitmap (e.g. unions and run-end encoded arrays).ChunkedArrayonly exposednull_count(), which does not account for those logical nulls, so callers had to hand-roll a loop over the chunks. This PR closes that gap.What changes are included in this PR?
Add
ChunkedArray::ComputeLogicalNullCount(), returning the sum ofArray::ComputeLogicalNullCount()over the chunks. As with theArraylevel method, the value is recomputed on each call rather than cached.Are these changes tested?
Yes. A new
TestChunkedArray.ComputeLogicalNullCounttest covers three cases:a type with a validity bitmap (result matches
null_count()),an empty chunked array, and,
a run-end encoded chunked array (where
null_count()is 0 but the logical null count is not).Are there any user-facing changes?
Yes, this adds a new public method,
ChunkedArray::ComputeLogicalNullCount(). The change is purely additive; no existing APIs are modified.ComputeLogicalNullCountmethod toChunkedArray#50260