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


##########
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:
   Don't you have to set the `0`s as well? Assuming input is pre-zeroed is OK 
as long it's clearly documents. Not setting zeroes has an advantage: allows 
this to be used to implement a logical OR between an existing bitmap and one 
derived from the REE.



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