| 619 | using Utf8NormalizeBase::Utf8NormalizeBase; |
| 620 | |
| 621 | static Status Exec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 622 | const auto& options = State::Get(ctx); |
| 623 | Utf8NormalizeExec exec{options}; |
| 624 | |
| 625 | const ArraySpan& array = batch[0].array; |
| 626 | BufferBuilder data_builder(ctx->memory_pool()); |
| 627 | |
| 628 | const offset_type* in_offsets = array.GetValues<offset_type>(1); |
| 629 | if (array.length > 0) { |
| 630 | RETURN_NOT_OK(data_builder.Reserve(in_offsets[array.length] - in_offsets[0])); |
| 631 | } |
| 632 | |
| 633 | // Output offsets are preallocated |
| 634 | ArrayData* output = out->array_data().get(); |
| 635 | offset_type* out_offsets = output->GetMutableValues<offset_type>(1); |
| 636 | |
| 637 | int64_t offset = 0; |
| 638 | *out_offsets++ = static_cast<offset_type>(offset); |
| 639 | |
| 640 | RETURN_NOT_OK(VisitArraySpanInline<Type>( |
| 641 | array, |
| 642 | [&](std::string_view v) { |
| 643 | ARROW_ASSIGN_OR_RAISE(auto n_bytes, exec.Decompose(v, &data_builder)); |
| 644 | offset += n_bytes; |
| 645 | *out_offsets++ = static_cast<offset_type>(offset); |
| 646 | return Status::OK(); |
| 647 | }, |
| 648 | [&]() { |
| 649 | *out_offsets++ = static_cast<offset_type>(offset); |
| 650 | return Status::OK(); |
| 651 | })); |
| 652 | |
| 653 | return data_builder.Finish(&output->buffers[2]); |
| 654 | } |
| 655 | }; |
| 656 | |
| 657 | const FunctionDoc utf8_normalize_doc( |
nothing calls this directly
no test coverage detected