Hello,

We are trying to migrate from Arrow 0.16.0 to a newer version, hopefully up
to 4.0.0. The Arrow 0.17.0 change in AllocateBuffer from taking a
shared_ptr<Buffer> to returning a unique_ptr<Buffer> is making things very
difficult. We wonder if there is a strong reason behind the change from
shared_ptr to unique_ptr and if there is an easier path forward for us.

In our code, we interchangeably use Buffer and ResizableBuffer. We pass
around these pointers across a number of classes. They are allocated or
resized here
https://github.com/Paradigm4/bridge/blob/master/src/Driver.h#L191 Moreover,
we cast the ResizableBuffer instance to Buffer in order to have all our
methods only deal with Buffer, here
https://github.com/Paradigm4/bridge/blob/master/src/Driver.h#L151

In Arrow 0.16.0 AllocateBuffer took a shared_ptr<Buffer> and this works
fine. In Arrow 0.17.0 AllocateBuffer returns a unique_ptr<Buffer>. Our cast
from ResizableBuffer to Buffer won't work on unique_ptr and we won't be
able to pass the Buffer around so easily.

I noticed that there is another AllocateBuffer in MemoryManger that returns
a shared_ptr.
https://arrow.apache.org/docs/cpp/api/memory.html?highlight=resizablebuffer#_CPPv4N5arrow13MemoryManager14AllocateBufferE7int64_t
Is this a better alternative to allocate a buffer? Is there a similar
method to allocate a resizable buffer?

Thank you,
Rares

Reply via email to