Remove From
impls that copy data into arrow_buffer::Buffer
#6033
Labels
api-change
Changes to the arrow API
enhancement
Any new improvement worthy of a entry in the changelog
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
@XiangpengHao found this on #6031 and I am breaking it into its own ticket
However,
self.buf
isbytes::Bytes
, notarrow_buffer::Bytes
(they confusingly having the same name). The consequence is that the code above will use this From implarrow-rs/arrow-buffer/src/buffer/immutable.rs
Lines 361 to 370 in 3ce8e84
Which results in a copy of data
To avoid the copy, the code is changed to
Describe the solution you'd like
We should do something to prevent future very subtle mistakes (and possibly remove other instances of such mistakes in arrow-rs)
Describe alternatives you've considered
One thing we could do is to remove any
From
impls for Buffer that copy data and instead use an explicit function name. This would make it more explicit when copying was occuring, providing more control and making mistakes such as fixed in #6031 less likelySomething like this, for example
Additional context
The text was updated successfully, but these errors were encountered: