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

Method CopySlice

cpp/src/arrow/buffer.cc:34–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace arrow {
33
34Result<std::shared_ptr<Buffer>> Buffer::CopySlice(const int64_t start,
35 const int64_t nbytes,
36 MemoryPool* pool) const {
37 // Sanity checks
38 ARROW_CHECK_LE(start, size_);
39 ARROW_CHECK_LE(nbytes, size_ - start);
40 DCHECK_GE(nbytes, 0);
41
42 ARROW_ASSIGN_OR_RAISE(auto new_buffer, AllocateResizableBuffer(nbytes, pool));
43 std::memcpy(new_buffer->mutable_data(), data() + start, static_cast<size_t>(nbytes));
44 return new_buffer;
45}
46
47Buffer::Buffer() : Buffer(memory_pool::internal::kZeroSizeArea, 0) {}
48

Callers 5

garrow_buffer_copyFunction · 0.80
TESTFunction · 0.80
MaybeAlignMetadataFunction · 0.80
TESTFunction · 0.80

Calls 2

dataFunction · 0.70
mutable_dataMethod · 0.45

Tested by 2

TESTFunction · 0.64
TESTFunction · 0.64