hadrian-reppas commented on code in PR #50269:
URL: https://github.com/apache/arrow/pull/50269#discussion_r3792933000


##########
cpp/src/arrow/util/dict_util.cc:
##########
@@ -78,5 +116,54 @@ int64_t LogicalNullCount(const ArraySpan& span) {
       return LogicalNullCount<Int64Type>(span);
   }
 }
+
+void SetLogicalNullBits(const ArraySpan& span, uint8_t* out_bitmap, int64_t 
out_offset,
+                        bool set_on_null) {
+  if (span.dictionary().GetNullCount() == 0) {
+    // No nulls in dictionary, so a value is a logical null if and only if
+    // its index is null
+    if (span.GetNullCount() == 0) {
+      // No null indices either (and possibly no validity bitmap at all), so
+      // there are no logical nulls
+      bit_util::SetBitsTo(out_bitmap, out_offset, span.length, !set_on_null);
+    } else if (set_on_null) {
+      internal::InvertBitmap(span.buffers[0].data, span.offset, span.length, 
out_bitmap,
+                             out_offset);
+    } else {
+      internal::CopyBitmap(span.buffers[0].data, span.offset, span.length, 
out_bitmap,
+                           out_offset);
+    }
+    return;
+  }
+
+  const auto& dict_array_type = internal::checked_cast<const 
DictionaryType&>(*span.type);
+  switch (dict_array_type.index_type()->id()) {

Review Comment:
   Should we wait for this to land? Looks like there is already one PR awaiting 
review. I could also give it a shot.



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