lidavidm commented on a change in pull request #10987:
URL: https://github.com/apache/arrow/pull/10987#discussion_r695913702
##########
File path: cpp/src/arrow/compute/kernels/scalar_if_else.cc
##########
@@ -1827,9 +1827,131 @@ Status ExecArrayCoalesce(KernelContext* ctx, const
ExecBatch& batch, Datum* out)
return Status::OK();
}
+// Special case: implement 'coalesce' for an array and a scalar for any
+// fixed-width type (a 'fill_null' operation)
+template <typename Type>
+Status ExecArrayScalarCoalesce(KernelContext* ctx, Datum left, Datum right,
+ int64_t length, Datum* out) {
+ ArrayData* output = out->mutable_array();
+ const int64_t out_offset = output->offset;
+ uint8_t* out_valid = output->buffers[0]->mutable_data();
+ uint8_t* out_values = output->buffers[1]->mutable_data();
+
+ const ArrayData& left_arr = *left.array();
+ const uint8_t* left_valid =
+ left_arr.MayHaveNulls() ? left_arr.buffers[0]->data() : nullptr;
+ arrow::internal::OptionalBitBlockCounter bit_counter(left_valid,
left_arr.offset,
Review comment:
It was not helpful in case_when but might be useful here, I can give it
a try.
--
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]