-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Describe the enhancement requested
BufferReader can be constructed from a pointer and length:
arrow/cpp/src/arrow/io/memory.cc
Lines 277 to 279 in 0e677d2
| BufferReader::BufferReader(std::string_view data) | |
| : BufferReader(reinterpret_cast<const uint8_t*>(data.data()), | |
| static_cast<int64_t>(data.size())) {} |
In that case, it will happily hand you a Buffer backed by that pointer:
arrow/cpp/src/arrow/io/memory.cc
Line 353 in 0e677d2
| return std::make_shared<Buffer>(data_ + position, nbytes); |
However, I don't think the APIs make it clear that this ties the lifetime of any data read from the reader to the lifetime of the input. It would be clearer if it would copy in this case, and require you to explicitly construct BufferReader from a Buffer if you want to enable zero-copy.
Component(s)
C++