| 678 | template <typename Type> |
| 679 | struct 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 | |
| 722 | template <typename Type> |
nothing calls this directly
no test coverage detected