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

Function Reserve

cpp/src/arrow/array/builder_binary.h:522–539  ·  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

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