You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AnuragRaut08 (via GitHub)" <gi...@apache.org> on 2026/09/01 15:50:47 UTC
Re: [PR] GH-51029: [C++] Fix MapArray validation with unknown null count [arrow]
AnuragRaut08 commented on code in PR #51093:
URL: https://github.com/apache/arrow/pull/51093#discussion_r3905873729
##########
cpp/src/arrow/array/array_nested.cc:
##########
@@ -896,13 +896,19 @@ Status MapArray::ValidateChildData(
if (pair_data->type->id() != Type::STRUCT) {
return Status::Invalid("Map array child array should have struct type");
}
- if (pair_data->MayHaveNulls()) {
+ // Use GetNullCount() rather than MayHaveNulls() so that an all-valid
+ // validity bitmap (null_count == kUnknownNullCount but every bit set)
+ // is not mistakenly treated as containing nulls. MayHaveNulls() returns
+ // true whenever a bitmap is present and null_count != 0, which includes
+ // kUnknownNullCount (-1); GetNullCount() actually counts the bits and
+ // caches the result. See GH-51029.
+ if (pair_data->GetNullCount() != 0) {
Review Comment:
Done, removed the lengthy comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org