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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to