Commit e917aa7
authored
### Rationale for this change
`Array` and `ArrayData` expose `ComputeLogicalNullCount()`, which counts logical nulls for types that carry them without a validity bitmap (e.g. unions and run-end encoded arrays).
`ChunkedArray` only exposed `null_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 of `Array::ComputeLogicalNullCount()` over the chunks. As with the `Array`level method, the value is recomputed on each call rather than cached.
### Are these changes tested?
Yes. A new `TestChunkedArray.ComputeLogicalNullCount` test 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.
* GitHub Issue: #50260
Authored-by: Rahul Goel <goel.rahul4200@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 6b4c524 commit e917aa7
3 files changed
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
79 | 111 | | |
80 | 112 | | |
81 | 113 | | |
| |||
0 commit comments