hadrian-reppas commented on code in PR #50269:
URL: https://github.com/apache/arrow/pull/50269#discussion_r3792931944
##########
cpp/src/arrow/compute/kernels/scalar_validity.cc:
##########
@@ -101,45 +80,74 @@ static void SetNanBits(const ArraySpan& arr, uint8_t*
out_bitmap, int64_t out_of
}
}
-Status IsNullExec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) {
- const ArraySpan& arr = batch[0].array;
- ArraySpan* out_span = out->array_span_mutable();
- if (arr.type->id() == Type::NA) {
- bit_util::SetBitsTo(out_span->buffers[1].data, out_span->offset,
out_span->length,
- true);
- return Status::OK();
- }
-
- const auto& options = NanOptionsState::Get(ctx);
- uint8_t* out_bitmap = out_span->buffers[1].data;
- if (arr.GetNullCount() > 0) {
- // Input has nulls => output is the inverted null (validity) bitmap.
- InvertBitmap(arr.buffers[0].data, arr.offset, arr.length, out_bitmap,
- out_span->offset);
+// `nan_is_null` can only be true for the is_null kernel since the is_valid and
+// true_unless_null kernels currently do not take `NullOptions`
+Status SetLogicalNullBits(const ArraySpan& span, uint8_t* out_bitmap, int64_t
out_offset,
+ bool set_on_null, bool nan_is_null) {
+ const Type::type t = span.type->id();
+ if (t == Type::NA) {
+ // Input is all nulls, so all output bits are the same.
+ bit_util::SetBitsTo(out_bitmap, out_offset, span.length, set_on_null);
+ } else if (t == Type::SPARSE_UNION) {
+ union_util::SetLogicalNullBitsSparse(span, out_bitmap, out_offset,
set_on_null);
+ } else if (t == Type::DENSE_UNION) {
+ union_util::SetLogicalNullBitsDense(span, out_bitmap, out_offset,
set_on_null);
+ } else if (t == Type::RUN_END_ENCODED) {
+ ree_util::SetLogicalNullBits(span, out_bitmap, out_offset, set_on_null);
+ } else if (t == Type::DICTIONARY) {
+ dict_util::SetLogicalNullBits(span, out_bitmap, out_offset, set_on_null);
Review Comment:
Done: #50889
--
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]