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

Function Reserve

cpp/src/arrow/array/builder_binary.h:520–537  ·  view source on GitHub ↗

\brief Ensure that the indicated number of bytes can be appended via UnsafeAppend operations without the need to allocate more memory

Source from the content-addressed store, hash-verified

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;

Callers 12

AppendMethod · 0.70
AppendNullsMethod · 0.70
AppendNullMethod · 0.70
AppendEmptyValueMethod · 0.70
AppendEmptyValuesMethod · 0.70
AppendValuesMethod · 0.70
AppendArraySliceMethod · 0.70
AppendFunction · 0.70
AppendNullsFunction · 0.70
AppendNullFunction · 0.70
AppendEmptyValueFunction · 0.70
AppendEmptyValuesFunction · 0.70

Calls 7

ValueSizeLimitFunction · 0.85
CapacityErrorFunction · 0.85
AllocateResizableBufferFunction · 0.85
emplace_backMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50
OKFunction · 0.50
mutable_dataMethod · 0.45

Tested by

no test coverage detected