dmitry-chirkov-dremio commented on code in PR #55425:
URL: https://github.com/apache/arrow/pull/55425#discussion_r4560759679


##########
cpp/src/arrow/compute/kernels/scalar_compare.cc:
##########
@@ -380,6 +381,225 @@ struct VarArgsCompareFunction : ScalarFunction {
   }
 };
 
+// Shared equality comparison between a BinaryView array and any 
BaseBinaryScalar.
+// Pins scalar length and 4-byte prefix in registers for early rejection before
+// dereferencing view variadic buffers.
+template <typename Op>
+Status ViewArrayCompareBinaryScalarEqual(KernelContext* ctx, const ArraySpan& 
arg0,
+                                         const Scalar& arg1, ExecResult* out) {
+  constexpr bool kIsEqual = std::is_same_v<Op, Equal>;
+  if (!arg1.is_valid) {
+    return applicator::OutputAdapter<BooleanType>::Write(ctx, 
out->array_span_mutable(),
+                                                         []() -> bool { return 
false; });
+  }
+  const auto* views0 = arg0.GetValues<BinaryViewType::c_type>(1);
+  const auto* buffers0 = arg0.GetVariadicBuffers().data();
+  const auto& scalar = checked_cast<const BaseBinaryScalar&>(arg1);
+  std::string_view s = scalar.view();
+  BinaryViewType::c_type s_val = util::ToBinaryView(s, 0, 0);

Review Comment:
   Can the second value in str_arr match buf1? Currently it has a different 
length, so that row returns before reading buffer 1



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