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

Method Exec

cpp/src/arrow/compute/kernels/vector_replace.cc:680–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678template <typename Type>
679struct FillNullForwardChunked {
680 static Status Exec(KernelContext* ctx, const ExecBatch& batch, Datum* out) {
681 const ChunkedArray& values = *batch[0].chunked_array();
682
683 if (values.null_count() == 0) {
684 *out = batch[0];
685 return Status::OK();
686 }
687 if (values.null_count() == values.length()) {
688 *out = batch[0];
689 return Status::OK();
690 }
691
692 ArrayVector new_chunks;
693 if (values.length() > 0) {
694 ArrayData* array_with_current = values.chunk(/*first_chunk=*/0)->data().get();
695 int64_t last_valid_value_offset = -1;
696 for (const std::shared_ptr<Array>& chunk : values.chunks()) {
697 if (is_fixed_width(out->type()->id())) {
698 ArrayData* output = out->mutable_array();
699 ARROW_ASSIGN_OR_RAISE(output->buffers[0], ctx->AllocateBitmap(chunk->length()));
700 ARROW_ASSIGN_OR_RAISE(
701 output->buffers[1],
702 ctx->Allocate(out->type()->byte_width() * chunk->length()));
703 }
704 ExecResult chunk_result;
705 chunk_result.value = out->array();
706 RETURN_NOT_OK(FillNullForward<Type>::ExecChunk(ctx, *chunk->data(), &chunk_result,
707 *array_with_current,
708 &last_valid_value_offset));
709 if (chunk->null_count() != chunk->length()) {
710 array_with_current = chunk->data().get();
711 }
712 new_chunks.push_back(MakeArray(chunk_result.array_data()->Copy()));
713 }
714 }
715
716 auto output = std::make_shared<ChunkedArray>(std::move(new_chunks), values.type());
717 *out = Datum(output);
718 return Status::OK();
719 }
720};
721
722template <typename Type>

Callers

nothing calls this directly

Calls 15

is_fixed_widthFunction · 0.85
chunked_arrayMethod · 0.80
AllocateBitmapMethod · 0.80
push_backMethod · 0.80
array_dataMethod · 0.80
MakeArrayFunction · 0.70
OKFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
DatumClass · 0.50
null_countMethod · 0.45
lengthMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected