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

Method Exec

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected