jorisvandenbossche commented on code in PR #35036:
URL: https://github.com/apache/arrow/pull/35036#discussion_r1163810191


##########
cpp/src/arrow/util/ree_util.cc:
##########
@@ -47,6 +47,25 @@ int64_t LogicalNullCount(const ArraySpan& span) {
   return null_count;
 }
 
+template <typename RunEndCType>
+void SetLogicalNullBits(const ArraySpan& span, uint8_t* out_bitmap, int64_t 
out_offset) {
+  const auto& values = ValuesArray(span);
+  const auto& values_bitmap = values.buffers[0].data;
+
+  RunEndEncodedArraySpan<RunEndCType> ree_span(span);
+  auto end = ree_span.end();
+  for (auto it = ree_span.begin(); it != end; ++it) {
+    const bool is_null =
+        values_bitmap &&
+        !bit_util::GetBit(values_bitmap, values.offset + 
it.index_into_array());
+    if (is_null) {
+      for (int64_t i = 0; i < it.run_length(); i++) {
+        bit_util::SetBit(out_bitmap, it.logical_position() + i + out_offset);
+      }
+    }

Review Comment:
   > I think this code should either be inlined or the function defined in 
`scalar_validity.cc` which seems to be the only place that will need a function 
that sets bitmap bits for NULL values and leaves the rest unchanged.
   
   That's certainly fine as well, there was no specific reason for putting it 
in those util files (other than seeing those exist and thinking that might be a 
good place). The `SetNanBits` is also defined in `scalar_validity.cc`.



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