| 358 | template <typename Type> |
| 359 | struct ReplaceMask { |
| 360 | static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 361 | const ArraySpan& arr = batch[0].array; |
| 362 | const ExecValue& mask = batch[1]; |
| 363 | const ExecValue& replacements = batch[2]; |
| 364 | RETURN_NOT_OK(CheckReplaceMaskInputs(*arr.type, arr.length, mask, |
| 365 | *replacements.type(), replacements.length(), |
| 366 | replacements.is_array())); |
| 367 | if (mask.is_scalar()) { |
| 368 | return ReplaceMaskImpl<Type>::ExecScalarMask( |
| 369 | ctx, arr, mask.scalar_as<BooleanScalar>(), replacements, |
| 370 | /*replacements_offset=*/0, out) |
| 371 | .status(); |
| 372 | } else { |
| 373 | // The extra mask offset is for dealing with chunked inputs, so zero when |
| 374 | // there is only a single chunk to process |
| 375 | return ReplaceMaskImpl<Type>::ExecArrayMask(ctx, arr, mask.array, |
| 376 | /*mask_offset=*/0, replacements, |
| 377 | /*replacements_offset=*/0, out) |
| 378 | .status(); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | static std::shared_ptr<KernelSignature> GetSignature(detail::GetTypeId get_id) { |
| 383 | return KernelSignature::Make({InputType(get_id.id), boolean(), InputType(get_id.id)}, |