MCPcopy Create free account
hub / github.com/apache/arrow / Exec

Method Exec

cpp/src/arrow/compute/kernels/scalar_string_utf8.cc:621–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
657const FunctionDoc utf8_normalize_doc(

Callers

nothing calls this directly

Calls 7

array_dataMethod · 0.80
GetFunction · 0.50
OKFunction · 0.50
memory_poolMethod · 0.45
ReserveMethod · 0.45
getMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected