pitrou commented on code in PR #41021:
URL: https://github.com/apache/arrow/pull/41021#discussion_r1553190784


##########
cpp/src/arrow/array/builder_nested.h:
##########
@@ -181,14 +181,13 @@ class ARROW_EXPORT VarLengthListLikeBuilder : public 
ArrayBuilder {
     if constexpr (is_list_view(TYPE::type_id)) {
       sizes = array.GetValues<offset_type>(2);
     }
+    const bool has_validity = array.buffers[0].data != NULLPTR;
     const bool all_valid = !array.MayHaveLogicalNulls();
-    const uint8_t* validity = array.HasValidityBitmap() ? 
array.buffers[0].data : NULLPTR;
     ARROW_RETURN_NOT_OK(Reserve(length));
     for (int64_t row = offset; row < offset + length; row++) {
-      const bool is_valid =
-          all_valid || (validity && bit_util::GetBit(validity, array.offset + 
row)) ||
-          array.IsValid(row);

Review Comment:
   I'm not sure why the original code was written like this, but if you care 
about performance (which seems the point of adding assumptions), then using 
`GetBit` into the validity bitmap should be slightly faster than going through 
the `IsValid` method.



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