nirandaperera commented on a change in pull request #10538:
URL: https://github.com/apache/arrow/pull/10538#discussion_r663113754



##########
File path: cpp/src/arrow/compute/kernels/scalar_if_else.cc
##########
@@ -78,19 +80,37 @@ Status PromoteNullsVisitor(KernelContext* ctx, const Datum& 
cond_d, const Datum&
   // cond.valid & (cond.data & left.valid | ~cond.data & right.valid)
   // In the following cases, we dont need to allocate out_valid bitmap
 
-  // if cond & left & right all ones, then output is all valid. output 
validity buffer
-  // is already allocated, hence set all bits
+  // if cond & left & right all ones, then output is all valid.
+  // if output validity buffer is already allocated (NullHandling::
+  // COMPUTED_PREALLOCATE) -> set all bits
+  // else, return nullptr
   if (cond_const == kAllValid && left_const == kAllValid && right_const == 
kAllValid) {
-    BitUtil::SetBitmap(output->buffers[0]->mutable_data(), output->offset,
-                       output->length);
+    if (AllocateMem::value) {
+      output->buffers[0] = nullptr;
+    } else {  // NullHandling::COMPUTED_NO_PREALLOCATE

Review comment:
       yes it does. My bad! 




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