Prepare an output ArrayData to be written to. If Kernel::mem_allocation is not MemAllocation::PREALLOCATE, then no data buffers will be set
| 727 | // Kernel::mem_allocation is not MemAllocation::PREALLOCATE, then no |
| 728 | // data buffers will be set |
| 729 | Result<std::shared_ptr<ArrayData>> PrepareOutput(int64_t length) { |
| 730 | auto out = std::make_shared<ArrayData>(output_type_.GetSharedPtr(), length); |
| 731 | out->buffers.resize(output_num_buffers_); |
| 732 | |
| 733 | if (validity_preallocated_) { |
| 734 | ARROW_ASSIGN_OR_RAISE(out->buffers[0], kernel_ctx_->AllocateBitmap(length)); |
| 735 | } |
| 736 | if (kernel_->null_handling == NullHandling::OUTPUT_NOT_NULL) { |
| 737 | out->null_count = 0; |
| 738 | } |
| 739 | for (size_t i = 0; i < data_preallocated_.size(); ++i) { |
| 740 | const auto& prealloc = data_preallocated_[i]; |
| 741 | if (prealloc.bit_width >= 0) { |
| 742 | ARROW_ASSIGN_OR_RAISE( |
| 743 | out->buffers[i + 1], |
| 744 | AllocateDataBuffer(kernel_ctx_, length + prealloc.added_length, |
| 745 | prealloc.bit_width)); |
| 746 | } |
| 747 | } |
| 748 | return out; |
| 749 | } |
| 750 | |
| 751 | Status CheckResultType(const Datum& out, const char* function_name) override { |
| 752 | const auto& type = out.type(); |
nothing calls this directly
no test coverage detected