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