felipecrv commented on issue #36708:
URL: https://github.com/apache/arrow/issues/36708#issuecomment-1639133737

   Found the reason: `AdjustNonNullable` zeroes the validity buffer if 
`null_count` is passed as `0`.
   
   ```cpp
   static inline void AdjustNonNullable(Type::type type_id, int64_t length,
                                        std::vector<std::shared_ptr<Buffer>>* 
buffers,
                                        int64_t* null_count) {
     if (type_id == Type::NA) {
       *null_count = length;
       (*buffers)[0] = nullptr;
     } else if (internal::HasValidityBitmap(type_id)) {
       if (*null_count == 0) {
         // In case there are no nulls, don't keep an allocated null bitmap 
around
         (*buffers)[0] = nullptr;
       } else if (*null_count == kUnknownNullCount && buffers->at(0) == 
nullptr) {
         // Conversely, if no null bitmap is provided, set the null count to 0
         *null_count = 0;
       }
     } else {
       *null_count = 0;
     }
   }
   ```


-- 
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