R-JunmingChen commented on code in PR #36739:
URL: https://github.com/apache/arrow/pull/36739#discussion_r1268311165


##########
cpp/src/arrow/compute/kernels/scalar_set_lookup.cc:
##########
@@ -380,6 +380,120 @@ Status ExecIndexIn(KernelContext* ctx, const ExecSpan& 
batch, ExecResult* out) {
 }
 
 // ----------------------------------------------------------------------
+// In writes the results into a preallocated boolean data bitmap
+struct InVisitor {
+  KernelContext* ctx;
+  const ArraySpan& data;
+  ArraySpan* out;
+  uint8_t* out_boolean_bitmap;
+  uint8_t* out_null_bitmap;
+
+  InVisitor(KernelContext* ctx, const ArraySpan& data, ArraySpan* out)
+      : ctx(ctx),
+        data(data),
+        out(out),
+        out_boolean_bitmap(out->buffers[1].data),
+        out_null_bitmap(out->buffers[0].data) {}
+
+  Status Visit(const DataType& type) {
+    DCHECK_EQ(type.id(), Type::NA);
+    // skip_nulls is ignored in sql-compatible In
+    bit_util::SetBitsTo(out_boolean_bitmap, out->offset, out->length, false);
+    bit_util::SetBitsTo(out_null_bitmap, out->offset, out->length, true);
+
+    return Status::OK();
+  }
+
+  template <typename Type>
+  Status ProcessIsIn(const SetLookupState<Type>& state, const ArraySpan& 
input) {
+    using T = typename GetViewType<Type>::T;
+    FirstTimeBitmapWriter writer_boolean(out_boolean_bitmap, out->offset, 
out->length);
+    FirstTimeBitmapWriter writer_null(out_null_bitmap, out->offset, 
out->length);
+    bool value_set_has_null = state.null_index != -1;
+    VisitArraySpanInline<Type>(
+        input,
+        [&](T v) {
+          if (state.lookup_table->Get(v) != -1) {
+            writer_boolean.Set();
+            writer_null.Clear();

Review Comment:
   Sorry for that mistake, have updated



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