You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] ComputeLogicalNullCount crashes for dictionary arrays with null value type #50699
Describe the bug, including details regarding any error messages, version, and platform.
Describe the bug, including details regarding any error messages, version, and platform
Array::ComputeLogicalNullCount segfaults for dictionary arrays whose value type is null(), even though the array passes full validation:
auto type = dictionary(int32(), null());
auto array = DictArrayFromJSON(type, R"([0, 0, null])", "[null]");
ASSERT_OK(array->ValidateFull());
array->ComputeLogicalNullCount(); // segfault
The values array of such a dictionary is a NullArray, which reports null_count == length without having a validity bitmap (buffers[0] is null). The early-out in dict_util::LogicalNullCount only triggers when the dictionary's null count is 0, so the per-index loop unconditionally reads the null validity-bitmap pointer:
Note that element-wise Array::IsValid handles the same data correctly (it falls back to null_count == length when there is no bitmap), so the aggregate and per-element views of logical nullness disagree.
The crash is also reachable from the bindings through the C++ count kernel, which uses ComputeLogicalNullCount when counting nulls (e.g. pyarrow.compute.count(arr, mode="only_null") on such an array).
Activity
goel-skd commentedon Jul 29, 2026
take