| 260 | using T = typename Type::c_type; |
| 261 | |
| 262 | static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 263 | const auto kernel = static_cast<const ScalarKernel*>(ctx->kernel()); |
| 264 | DCHECK(kernel); |
| 265 | const auto kernel_data = checked_cast<const CompareData*>(kernel->data.get()); |
| 266 | |
| 267 | ArraySpan* out_arr = out->array_span_mutable(); |
| 268 | |
| 269 | // TODO: implement path for offset not multiple of 8 |
| 270 | const bool out_is_byte_aligned = out_arr->offset % 8 == 0; |
| 271 | |
| 272 | std::shared_ptr<Buffer> out_buffer_tmp; |
| 273 | uint8_t* out_buffer; |
| 274 | if (out_is_byte_aligned) { |
| 275 | out_buffer = out_arr->buffers[1].data + out_arr->offset / 8; |
| 276 | } else { |
| 277 | ARROW_ASSIGN_OR_RAISE(out_buffer_tmp, ctx->AllocateBitmap(batch.length)); |
| 278 | out_buffer = out_buffer_tmp->mutable_data(); |
| 279 | } |
| 280 | if (batch[0].is_array() && batch[1].is_array()) { |
| 281 | kernel_data->func_aa(batch[0].array.GetValues<T>(1), batch[1].array.GetValues<T>(1), |
| 282 | batch.length, out_buffer); |
| 283 | } else if (batch[1].is_scalar()) { |
| 284 | T value = UnboxScalar<Type>::Unbox(*batch[1].scalar); |
| 285 | kernel_data->func_as(batch[0].array.GetValues<T>(1), &value, batch.length, |
| 286 | out_buffer); |
| 287 | } else { |
| 288 | T value = UnboxScalar<Type>::Unbox(*batch[0].scalar); |
| 289 | kernel_data->func_sa(&value, batch[1].array.GetValues<T>(1), batch.length, |
| 290 | out_buffer); |
| 291 | } |
| 292 | if (!out_is_byte_aligned) { |
| 293 | ::arrow::internal::CopyBitmap(out_buffer, /*offset=*/0, batch.length, |
| 294 | out_arr->buffers[1].data, out_arr->offset); |
| 295 | } |
| 296 | return Status::OK(); |
| 297 | } |
| 298 | }; |
| 299 | |
| 300 | template <typename Op> |
nothing calls this directly
no test coverage detected