\brief Ensure that the indicated number of bytes can be appended via UnsafeAppend operations without the need to allocate more memory
| 518 | /// \brief Ensure that the indicated number of bytes can be appended via |
| 519 | /// UnsafeAppend operations without the need to allocate more memory |
| 520 | Status Reserve(int64_t num_bytes) { |
| 521 | if (ARROW_PREDICT_FALSE(num_bytes > ValueSizeLimit())) { |
| 522 | return Status::CapacityError( |
| 523 | "BinaryView or StringView elements cannot reference " |
| 524 | "strings larger than 2GB"); |
| 525 | } |
| 526 | if (num_bytes > current_remaining_bytes_) { |
| 527 | ARROW_RETURN_NOT_OK(FinishLastBlock()); |
| 528 | current_remaining_bytes_ = num_bytes > blocksize_ ? num_bytes : blocksize_; |
| 529 | ARROW_ASSIGN_OR_RAISE( |
| 530 | std::shared_ptr<ResizableBuffer> new_block, |
| 531 | AllocateResizableBuffer(current_remaining_bytes_, alignment_, pool_)); |
| 532 | current_offset_ = 0; |
| 533 | current_out_buffer_ = new_block->mutable_data(); |
| 534 | blocks_.emplace_back(std::move(new_block)); |
| 535 | } |
| 536 | return Status::OK(); |
| 537 | } |
| 538 | |
| 539 | void Reset() { |
| 540 | current_offset_ = 0; |
no test coverage detected