amol- commented on a change in pull request #10199:
URL: https://github.com/apache/arrow/pull/10199#discussion_r625640867



##########
File path: cpp/src/arrow/python/numpy_to_arrow.cc
##########
@@ -594,7 +594,13 @@ Status NumPyConverter::Visit(const FixedSizeBinaryType& 
type) {
 
   if (mask_ != nullptr) {
     Ndarray1DIndexer<uint8_t> mask_values(mask_);
-    RETURN_NOT_OK(builder.AppendValues(data, length_, mask_values.data()));
+    std::unique_ptr<uint8_t[]> inverted_mask(new uint8_t[length_]);
+    for (int64_t i = 0; i < length_; ++i) {
+      inverted_mask[i] = !mask_values[i];
+    }

Review comment:
       I'm wondering, given that this seems a fairly reasonable need, if the 
ArrayBuilder itself shouldn't have a specialised version of `AppendValues` that 
accepts a mask. Maybe `AppendValuesWithMask`. 
   
   It seems confusing, on the other side, that the builder interface would have 
multiple different "definitions" of how to edit the bitmap, but in the end we 
already have such dichotomy in place as the ``Array`` **mask** is ``True for 
NULL`` while the **bitmap** is ``0 for NULL`` 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to